-
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
for_each on google_compute_instance with map of boot disk : impact others #4286
Comments
Looks like the problem is at "source = lookup(google_compute_disk.boot_disk,each.key).self_link" — your vmname1 has a boot disk of vmname2 |
Hi Chupaka, no. Sorry, maybe not enough detailed in the current "Actual Behavior", I'll update. But I confirm the change impact only the vmname2 disk. After apply, the vmname1 and vmname2 are update (shutdown, remove, recreate, start) but vmname1 rebuilded exactly with the same disk (disk vmname1 not rebuilded) and of course vmname2 rebuilded with her new rebuilded disk. So the strange behavior is that vmname1 is rebuild even if disk not change. It looks like when terraform detect an update in the list of boot disk (created with for_each too), all instance need rebuild (even if no update on the linked diks). |
I suspect that the timestamp on the disk name is causing the diff: The field that forces recreate in your example is the name field which presumably has been recalculated since the timestamp has changed. If you remove the timestamp and attempt to reproduce do you still see the recreation of vmname1? |
Hi slevenick, Not caused by the timestamp because I use ignore change for the name of the disk. I suspect than the provider (or terraform code) have issue to use a index with value ["vmname2-boot"] (because I use for_each feature) rather than int [1] (use when count feature is use) in the state file. |
@apparentlymart, could take a look on this issue please ? Because seems you are the master of the for_each on terraform :) |
This is an upstream issue so I'm closing this one in favor of the issue linked above. We'll reopen if it turns out otherwise. |
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! |
Community Note
Terraform Version
Terraform v0.12.6
Affected Resource(s)
google_compute_instance
Terraform Configuration Files
Terraform variables
terraform.tfvars :
Debug Output
https://gist.github.com/maxolodrou/e2ebafbbd879a5382ab40d09112526f4
Expected Behavior
When change something on vmname2 boot disk : change only configuration on vmname2 and not on vmname1 !
Actual Behavior
When change image for vmname2 that impact vmname1 :
Steps to Reproduce
terraform apply
terraform apply
The text was updated successfully, but these errors were encountered: