Terraform-provider-google: data `google_container_cluster` -> An argument named "zone" is not expected here.

Created on 29 Sep 2020  ·  4Comments  ·  Source: hashicorp/terraform-provider-google


Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave _+1_ or _me too_ comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version


Terraform v0.12.20
Terraform v0.13.3

  • provider.google v3.41.0
  • provider.google-beta v3.41.0

Affected Resource(s)

  • google_container_cluster

Terraform Configuration Files

data "google_container_cluster" "cluster" {
  name = var.cluster_name
  zone = var.cluster_zone
}

Debug Output

Error: Unsupported argument

  on main.tf line 20, in data "google_container_cluster" "cluster":
  20:   zone = var.cluster_zone

An argument named "zone" is not expected here.

Expected Behavior

No error

Actual Behavior

Error: Unsupported argument

  on main.tf line 20, in data "google_container_cluster" "cluster":
  20:   zone = var.cluster_zone

An argument named "zone" is not expected here.

Steps to Reproduce

  1. terraform validate/plan

Important Factoids

Works with v3.29.0
I have checked changelogs in the range of [v3.29.0:v3.41.0] and did not find any change that could cause this.
Am I missing something?

References

  • #0000
bug

All 4 comments

similar problem only with 3.41 version

Error: Invalid resource instance data in state
on .terraform/modules/ecom-gke-green/data.tf line 2:
2: data "google_container_engine_versions" "gke-version-euw1" {

data could not be decoded from the state: unsupported attribute "region".

I think there are two different issues here.

One, similar to https://github.com/hashicorp/terraform-provider-google/issues/7379 is an error when a field exists in state that the new provider version 3.41.0 does not expect. This should be solved by upgrading the version of Terraform you are running to at least 0.13.1.

The other is causing the error message: An argument named "zone" is not expected here. on the container cluster datasource. This is due to the argument zone being renamed to location during the 3.0.0 release of the google provider. This field was marked as Removed in 3.0.0 until 3.41.0 when it was actually removed from the provider. I don't believe the provider would accept the zone field on that datasource from 3.0.0 -> 3.40.0, but it would have displayed a more helpful error.

The solution here is to rename zone -> location. Unfortunately due to an upgrade we made in the Terraform SDK, we cannot display removed fields and messages anymore.

Closing as I believe this is not a provider bug. Please reopen this if upgrading Terraform to 0.13.1+ and changing from zone to location does not fix this issue for you

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