-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
google_compute_instance: Tries to change boot disk infos every time #988
Comments
Hey @waldiTM, I'm having trouble reproducing this. I tried running that config at v1.5.0 and also by running it at v1.4.0, upgrading to v1.5.0, and then running terraform plan again (in case it had something to do with the upgrade specifically). Can you comment with the full |
Your are right. I did not even see that only some instances show this behaviour. You can find the plan at https://gist.github.com/waldiTM/ff91d446f9b5a11bb2a61d73b3ad21ce and the code at https://gitlab.com/waldi/debian-mirror-cloud-terraform. |
FWIW, I am affected too with 1.5.0, also coming from 1.4.0, and also for some instances but not others in the same terraform configuration. Also, the subnetwork part is affected by the same issue.
Current workaroundUse |
@danawillow Here is more to help you pin point the root cause: Probably caused by #948. However, the diff on the For instance, the diff @waldiTM is showing should be suppressed by the DiffSuppressFunc. See unit test for this particular case: https://github.com/terraform-providers/terraform-provider-google/blob/master/google/resource_compute_disk_test.go#L79 |
Hmm, same issue here I guess with 1.5.0 vs. 1.4.0... But it says the "id" of the resource would be causing the destroy+create... Gist available here: https://gist.github.com/iniinikoski/0cbd04cee23a470d357131a1e09dca21 Locked to 1.4.0 for now... |
Thanks @iniinikoski! @rosbo, looks like this breaks our assumption that the family name will always be part of the image name:
That's different from the other examples above where the assumption did hold true, so I'm still curious why the DiffSuppress didn't work on those, but we may need to go with a different solution altogether. |
@danawillow We need to fix our DiffSuppressFunc to handle these cases too. I am still puzzled by the issue experienced by @pdecat and @waldiTM... It triggers an @iniinikoski, a workaround for the issue you are experiencing is to use the data "google_compute_image" "ubuntu" {
family = "ubuntu-1404-lts"
project = "ubuntu-os-cloud"
}
resource "google_compute_instance" "my-instance" {
// ...
boot_disk {
initialize_params {
image = "${data.google_compute_image.ubuntu.self_link}"
}
}
// ...
} |
1.6.0 does not fix the problem. As you mentioned that this plan should force a new resource: Is there a way to see in the debug output which resource actually triggers refreshs? I did not manage to find it. |
I updated to terraform 0.11.3 and the diffs looks larger:
|
But now the whole diff vanishes if I ignore |
And after some instrumentation I found out that
However I see a lot of calls without any old image, which according to the comment should not happen.
|
If I make this error condition return |
The problem in question is triggered by a completely different part of the config. I dropped a workaround for #926 and this seems make this problem go away:
|
Just checking back in here to see how things are going. Has anyone run into this issue recently? |
Hi @danawillow, I just tried to revert the changes I made to workaround the issue two months ago ( #988 (comment) ), i.e. using When using
|
@pdecat thanks! Do you have a configuration you'd be willing to share that can reproduce this? Ideally it would be something fairly small to make it easy to pinpoint what's going on. I'm pretty sure that this is an issue with tf core (since the issue is that it's showing a diff in the first place on something that should have been suppressed), but I'd rather not file the report there until I can say with certainty what's happening, and I still haven't been able to come up with a repro :-/ |
@danawillow I tried to put together a reproduction test case but failed to reproduce the issue outside of my actual complete stack so far. I quickly compared the trace level outputs of I think I have to resort to add some additional logging statements to that part of the code to understand what's going on... PS: I did not find an easy way to attach a debugger to a terraform spawn plugin process, that would have made it so much easier! Edit: turned out attaching delve to the terraform spawned plugin sub-process works fine, it's just a matter of timing. However, my last debugging session did not show any misbehaving from the google plugin diff suppress funcs... |
Similar issue upgrading from 1.12.0 to 1.13.0,
Note the Edit: passing the subnetwork name instead of its self_link does not work around the issue. |
Hmm, I'm not sure why our diffsuppress isn't catching that. Mind posting debug logs? |
Sure, let me redact some parts of it. Edit: sent you an email with the logs. |
Thanks- I took a look and didn't see anything weird. I'm sorry that we haven't gotten to the bottom of this yet. It's tough since it seems to only affect a few people, even though I know that a lot of people are using the |
Last time I tried, editing the state by hand did not help. A similar issue was just opened where some apparently unrelated field triggers a diff on network information where used: #1566 |
Quick update : updating the state is confirmed not to work. |
Bug filed against TF: hashicorp/terraform#18209 |
Edit: what actually resolved the issue and let me revert the workarounds put in place in January is that I removed the
PS: I realize I never shared my configuration source, sorry about that. |
Closing since upstream bug is fixed in HEAD. |
For now, getting around this with using the resource "google_compute_instance" "main" {
// normal stuff
lifecycle {
ignore_changes = [
"metadata_startup_script",
"boot_disk.0.initialize_params"
]
}
} |
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! |
Terraform Version
This is a regression from
Affected Resource(s)
Terraform Configuration Files
Debug Output
Expected Behavior
On subsequent apply calls no changes should be done.
Actual Behavior
All parameters of the boot disk are changed in a no-op operation:
If I ignore changes for
boot_disk.0.initialize_params.0.image
, it still tries to do this:Steps to Reproduce
terraform apply
The text was updated successfully, but these errors were encountered: