Terraform-provider-google: terraform 0.12.x Inappropriate value for attribute "nat_ips" in google_compute_router_nat

Created on 4 Jul 2019  ·  7Comments  ·  Source: hashicorp/terraform-provider-google

terraform -v
Terraform v0.12.3

  • provider.google v2.10.0
Error: Incorrect attribute value type

  on gke-cluster.tf line 107, in resource "google_compute_router_nat" "egress_nat_production":
 107:   nat_ips                            = ["${google_compute_address.egress_production.*.self_link}"]

Inappropriate value for attribute "nat_ips": element 0: string required.

Most helpful comment

Hi @scippio - can you try nat_ips = "$google_compute_address.egress_production[*].self_link"?

All 7 comments

Hi @scippio - can you try nat_ips = "$google_compute_address.egress_production[*].self_link"?

Thanks @tysen - that's resolved the same issue I'd just run into, perfect timing! Hopefully it will resolve @scippio too.

This parameter should be fixed in documentation https://www.terraform.io/docs/providers/google/r/compute_router_nat.html

The error occurs, for me, when using the lines in the updated documentation. The easiest way to reproduce this is by copying the production-like configuration as-is (at the above-referenced documentation URL). This is with terraform v0.12.6 and provider.google v2.12.0:

Error: Incorrect attribute value type

  on network-us-west2.tf line 32, in resource "google_compute_router_nat" "advanced-nat":
  32:   nat_ips                            = ["${google_compute_address.address[*].self_link}"]

Inappropriate value for attribute "nat_ips": element 0: string required.

Replacing line 32 with the string:

nat_ips = google_compute_address.address[*].self_link

works fine.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings