terraform-google-modules / terraform-google-startup-scripts

Provides a library of useful startup scripts to embed in VMs
https://registry.terraform.io/modules/terraform-google-modules/startup-scripts/google
Apache License 2.0
73 stars 36 forks source link

The example code is incorrect. #34

Closed aMasashiOgawa closed 1 year ago

aMasashiOgawa commented 2 years ago

TL;DR

The metadata needs = before block for Terraform 0.12+.

Expected behavior

terraform plan succeeds.

Observed behavior

terraform plan is failed.

% terraform plan
╷
│ Error: Unsupported block type
│ 
│   on main.tf line 55, in resource "google_compute_instance" "XXXXX":
│   55:   metadata {
│ 
│ Blocks of type "metadata" are not expected here. Did you mean to define argument "metadata"? If so, use the equals sign to assign it a value.
╵

Terraform Configuration

resource "google_compute_instance" "example" {
  # other attributes removed
  metadata {
    startup-script        = "${module.startup-script-lib.content}"
    startup-script-custom = "stdlib::info Hello World"
  }
}

Terraform Version

% terraform version
Terraform v1.2.1
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v4.22.0

Additional information

No response

aMasashiOgawa commented 2 years ago

https://github.com/terraform-google-modules/terraform-google-startup-scripts/pull/35

g-awmalik commented 1 year ago

Thanks for the PR. Please sign the CLA so we can merge this change. I'll close this issue for now.