GoogleCloudPlatform/terraform-google-examples

doesn't work on terraform ~>0.12.0

Opened this issue · 3 comments

ttsrg commented

Hello.
It is very old code.
Could you please tell me if you are going to rewrite the code.
ps I tried deploying lb and lb-http.

@ttsrg Running terraform 0.12upgrade will rewrite the config to respect the new format of terraform.

At least it worked for me :)

Even if the 0.12 upgrade worked - surely the examples should reflect current standards

I am still having issues even after running 0.13upgrade.

~/terraform-google-examples/example-lb-http$ terraform init
Initializing modules...
There are some problems with the configuration, described below.

The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.

Warning: Interpolation-only expressions are deprecated

on main.tf line 38, in provider "google":
38: region = "${var.group1_region}"

Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.

Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.

(and 324 more similar warnings elsewhere)

Warning: Quoted references are deprecated

on ../../main.tf line 24, in resource "google_compute_global_forwarding_rule" "http":
24: depends_on = ["google_compute_global_address.default"]

In this context, references are expected literally rather than in quotes.
Terraform 0.11 and earlier required quotes, but quoted references are now
deprecated and will be removed in a future version of Terraform. Remove the
quotes surrounding this reference to silence this warning.

(and 5 more similar warnings elsewhere)

Warning: Quoted type constraints are deprecated

on ../../variables.tf line 34, in variable "firewall_networks":
34: type = "list"

Terraform 0.11 and earlier required type constraints to be given in quotes,
but that form is now deprecated and will be removed in a future version of
Terraform. To silence this warning, remove the quotes around "list" and write
list(string) instead to explicitly indicate that the list elements are
strings.

(and 29 more similar warnings elsewhere)

Warning: Quoted keywords are deprecated

on .terraform/modules/mig1/main.tf line 104, in resource "google_compute_instance_group_manager" "default":
104: when = "destroy"

In this context, keywords are expected literally rather than in quotes.
Terraform 0.11 and earlier required quotes, but quoted keywords are now
deprecated and will be removed in a future version of Terraform. Remove the
quotes surrounding this keyword to silence this warning.

(and 7 more similar warnings elsewhere)

Error: Invalid reference from destroy provisioner

on .terraform/modules/mig1/main.tf line 105, in resource "google_compute_instance_group_manager" "default":
105: command = "${var.local_cmd_destroy}"

Destroy-time provisioners and their connection configurations may only
reference attributes of the related resource, via 'self', 'count.index', or
'each.key'.

References to other resources during the destroy phase can cause dependency
cycles and interact poorly with create_before_destroy.

Error: Invalid reference from destroy provisioner

on .terraform/modules/mig1/main.tf line 182, in resource "google_compute_region_instance_group_manager" "default":
182: command = "${var.local_cmd_destroy}"

Destroy-time provisioners and their connection configurations may only
reference attributes of the related resource, via 'self', 'count.index', or
'each.key'.

References to other resources during the destroy phase can cause dependency
cycles and interact poorly with create_before_destroy.

Error: Invalid reference from destroy provisioner

on .terraform/modules/mig2/main.tf line 105, in resource "google_compute_instance_group_manager" "default":
105: command = "${var.local_cmd_destroy}"

Destroy-time provisioners and their connection configurations may only
reference attributes of the related resource, via 'self', 'count.index', or
'each.key'.

References to other resources during the destroy phase can cause dependency
cycles and interact poorly with create_before_destroy.

Error: Invalid reference from destroy provisioner

on .terraform/modules/mig2/main.tf line 182, in resource "google_compute_region_instance_group_manager" "default":
182: command = "${var.local_cmd_destroy}"

Destroy-time provisioners and their connection configurations may only
reference attributes of the related resource, via 'self', 'count.index', or
'each.key'.

References to other resources during the destroy phase can cause dependency
cycles and interact poorly with create_before_destroy.