GoogleCloudPlatform / terraform-google-alloy-db

Creates an Alloy DB instance
https://registry.terraform.io/modules/GoogleCloudPlatform/alloy-db/google
Apache License 2.0
17 stars 16 forks source link

Module tries to access `gce_zone` field via `availability_type` string field #42

Closed SarahFrench closed 8 months ago

SarahFrench commented 8 months ago

Hi all,

I think that this line:

https://github.com/GoogleCloudPlatform/terraform-google-alloy-db/blob/81522e307211e2c0987c306340cc378db6d9339d/main.tf#L147

Needs to be updated to:

 gce_zone          = each.value.availability_type == "ZONAL" ? each.value.gce_zone : null 

Currently when I try to use the module this error occurs:

╷
│ Error: Unsupported attribute
│ 
│   on terraform-google-alloy-db/main.tf line 147, in resource "google_alloydb_instance" "read_pool":
│  147:   gce_zone          = each.value.availability_type == "ZONAL" ? each.value.availability_type.gce_zone : null
│     ├────────────────
│     │ each.value.availability_type is "ZONAL"
│ 
│ Can't access attributes on a primitive-typed value (string).

These are the provider versions I'm using:

$ terraform version

Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/hashicorp/google v5.5.0
+ provider registry.terraform.io/hashicorp/google-beta v5.5.0
+ provider registry.terraform.io/hashicorp/random v3.5.1