Supporting terraform version > 0.12.0
Opened this issue · 3 comments
It seems there is a restriction on terraform version (in main.tf):
terraform {
required_version = "< 0.12.0"
}
Upon terraform init
I get the following error:
Initializing modules...
- certs in ../modules/certs
- infra in ../modules/infra
- isolation_segment in ../modules/isolation_segment
- ops_manager in ../modules/ops_manager
- pas in ../modules/pas
Error: Unsupported Terraform Core version
This configuration does not support Terraform version 0.12.6. To proceed,
either choose another supported Terraform version or update the root module's
version constraint. Version constraints are normally set for good reason, so
updating the constraint may lead to other errors or unexpected behavior.
Is there a hard requirement on having terraform version <0.12.0
?
It seems terraform-0.12.* started on May 22, 2019:
https://github.com/hashicorp/terraform/releases/tag/v0.12.0
It also depends on
provider "azurerm" {
subscription_id = "${var.subscription_id}"
client_id = "${var.client_id}"
client_secret = "${var.client_secret}"
tenant_id = "${var.tenant_id}"
environment = "${var.cloud_name}"
version = "~> 1.22"
}
It seems terraform-provider-azurerm-1.27.0 was the first one to add support for terraform-0.12+:
https://github.com/terraform-providers/terraform-provider-azurerm/releases/tag/v1.27.0
You can use terraform init
with newer version dependency, and terraform 0.12upgrade
- the script will upgrade all variables and configuration to use new 0.12 configuration style, e.g.
- subscription_id = "${var.subscription_id}"
- client_id = "${var.client_id}"
- client_secret = "${var.client_secret}"
- tenant_id = "${var.tenant_id}"
- environment = "${var.cloud_name}"
+ subscription_id = var.subscription_id
+ client_id = var.client_id
+ client_secret = var.client_secret
+ tenant_id = var.tenant_id
+ environment = var.cloud_name
It also seems we used variable name count
which is reserved keyword for use in future versions of Terraform, e.g.
% terraform plan --out=plan ✹ ✭
Error: Reserved argument name in module block
on main.tf line 82, in module "isolation_segment":
82: count = var.isolation_segment ? 1 : 0
The name "count" is reserved for use in a future version of Terraform.
So, some refactoring might be required to support newer versions of Terraform (0.12+).