GoogleCloudPlatform/terraform-google-alloy-db

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

Closed this issue · 0 comments

Hi all,

I think that this line:

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

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