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

Fix google_compute_instance_template crash #1812

Conversation

modular-magician
Copy link
Collaborator

Fixes hashicorp/terraform-provider-google#5018

ForceNew logic for source_image was handled with in a custom diff. When source_image was a self_link to another resource, the custom diff would ForceNew the field before the dependent resource was resolved. This would lead to the SDK trying to sort out a change to a nil value.

To fix this, I took the forcenew logic out of the custom diff, and just set the field to ForceNew in the schema. This way, Terraform will resolve the ForceNew normally. The remaining custom diff acts as a more complicated diffSuppress. I'm not sure if it can be rewritten as an actual diffSuppress, since it takes in the meta object, where diffSuppress does not.

Also added a test that tests this specific scenario since it wasn't covered in the current set of tests.

Release Note Template for Downstream PRs (will be copied)

Fixed a scenario where `google_compute_instance_template` would cause a crash.

Derived from GoogleCloudPlatform/magic-modules#3194

Signed-off-by: Modular Magician <magic-modules@google.com>
@ghost ghost added the size/m label Mar 2, 2020
@modular-magician modular-magician merged commit 3601b8a into hashicorp:master Mar 2, 2020
@modular-magician modular-magician deleted the downstream-pr-2265580a60de529a69012ede17e0ad8c520204b3 branch November 16, 2024 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant