Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on plan for google_compute_region_instance_group_manager from docs - insufficient items for attribute "version" #4169

Closed
chrisbenincasa opened this issue Aug 6, 2019 · 6 comments
Assignees

Comments

@chrisbenincasa
Copy link
Contributor

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 -v
Terraform v0.12.6
+ provider.external v1.2.0
+ provider.google v2.12.0
+ provider.google-beta v2.12.0

Affected Resource(s)

  • google_compute_region_instance_group_manager

Terraform Configuration Files

resource "google_compute_region_instance_group_manager" "teletracker_backend_instance_group_manager" {
  provider = "google-beta"
  name     = "teletracker-api-${var.env}"

  base_instance_name = "teletracker-api-"
  region             = "us-east1"

  version {
    name              = "teletracker-api-${var.env}-main"
    instance_template = "${google_compute_instance_template.teletracker_backend_instance_template.self_link}"
    target_size {
      fixed = 1
    }
  }
}

Debug Output

https://gist.github.com/chrisbenincasa/645252d3546c4a8609e8189629fc8e11

Expected Behavior

The plan should have succeeded.

Actual Behavior

The plan fails with:

Error: insufficient items for attribute "version"; must have at least 1

Steps to Reproduce

  1. terraform plan
@chrisbenincasa
Copy link
Contributor Author

Could be an instance of: hashicorp/terraform-provider-aws#8982

@rileykarson
Copy link
Collaborator

I'm not seeing this issue locally. I attempted to repro with your config, as well as the following:

resource "google_compute_region_instance_group_manager" "teletracker_backend_instance_group_manager" {
  provider = "google-beta"
  name     = "teletracker-api-${var.env}"

  base_instance_name = "teletracker-api"
  region             = "us-east1"

  target_size = 1

  version {
    name              = "teletracker-api-${var.env}-main"
    instance_template = "${google_compute_instance_template.teletracker_backend_instance_template.self_link}"
  }
}

I'll track the upstream issue to see if this is due to something on the provider side, and close this out if it's not looking like it is.

@rileykarson
Copy link
Collaborator

Actually, I'm able to repro based on hashicorp/terraform-provider-aws#9048 (comment).

Running terraform import without provider=google-beta appears to be the cause.

terraform import defaults to importing using the google provider regardless of what you've set in config. Because the version field isn't present in the google provider, we're mostly importing the resource correctly but not setting that specific field.

It's required in the google-beta provider, though, and that appears to be causing an issue when Terraform coerces the state representation from the old SDK -> the new SDK, and performs a validation that didn't exist pre-0.12. That's happening at https://github.com/hashicorp/terraform/blob/587852773210f95268368a860f8bf837e6d11acf/configs/configschema/coerce_value.go#L120.

If you clear the resource from state with terraform state rm and import it again with provider=google-beta, this should work.

@chrisbenincasa
Copy link
Contributor Author

Ah yes, that was exactly it! Thank you!

@rileykarson
Copy link
Collaborator

Great, glad to hear!

Since there's no provider-side resolution other than waiting until hashicorp/terraform#22387 is fixed, I'm going to close this out.

@ghost
Copy link

ghost commented Sep 13, 2019

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!

@ghost ghost locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants