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

Beta resources are imported as v1 #694

Closed
negz opened this issue Nov 6, 2017 · 1 comment · Fixed by #1422
Closed

Beta resources are imported as v1 #694

negz opened this issue Nov 6, 2017 · 1 comment · Fixed by #1422

Comments

@negz
Copy link
Contributor

negz commented Nov 6, 2017

Terraform Version

v0.10.8 - Running the latest master of terraform-provider-google.

Affected Resource(s)

All resources that use beta GCP APIs, i.e:

  • google_compute_address
  • google_compute_firewall
  • google_compute_global_forwarding_rule
  • google_compute_instance
  • google_compute_instance_group_manager
  • google_compute_region_instance_group_manager

Expected Behavior

Beta fields should be correctly set when importing a beta resource.

Actual Behavior

Beta resources are imported as v1 resources.

References

Full details per @rosbo in #594 (review):

Does that mean that import is broken for any beta resource?

Yes, but running terraform apply fixes it. However, if the beta field is ForceNew, this is bad because the newly imported resource gets recreated!

Let's say you want to import the following resource:

resource "google_compute_address" "test" {
  name = "test"
  address_type = "INTERNAL"
  subnetwork = "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1/subnetworks/default"
}

When you run terraform import google_compute_address.test test

terraform show has address_type set to EXTERNAL (this is wrong!)
terraform plan shows a diff.
terraform apply will fix the diff by either calling update or create (depending on ForceNew value for the field) and the state should be properly set afterwards.

@rosbo rosbo self-assigned this Nov 6, 2017
negz pushed a commit to negz/terraform-provider-google that referenced this issue Nov 6, 2017
negz pushed a commit to negz/terraform-provider-google that referenced this issue Nov 7, 2017
@ghost
Copy link

ghost commented Nov 18, 2018

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 👉 hashibot-feedback@hashicorp.com. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.