-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Diffs are not getting suppressed when lifecycle.ignore_changes is ignoring a change to a different field #18209
Comments
Hi @danawillow, Thanks for the excellent detective work here! We're going to be making some significant changes to the |
Hi! any updates on this issue? Also, thanks for the investigation! |
This is very very annoying. I hope this can be addressed soon.... sigh |
Terraform used to provide empty diffs to the provider when calculating `ignore_changes`, which would cause some DiffSuppressFunc to fail, as can be seen in #18209. Verify that this is no longer the case in 0.12
Terraform used to provide empty diffs to the provider when calculating `ignore_changes`, which would cause some DiffSuppressFunc to fail, as can be seen in #18209. Verify that this is no longer the case in 0.12
This is fixed in master, with a test to verify added in the commit linked above. |
was this actually fixed? im still seeing the behavior in google_container_cluster in tf v0.11.10 I have to do this in order to prevent tf from seeing changes every time:
|
It should be part of upcoming terraform v0.12, it doesn’t seem to be in the v0.11 branch. |
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
FYI before you start- I've been debugging this for a while and know why the problem is occurring, just not how to fix it without breaking other things :)
Happy to give debug logs if necessary, but I don't suspect there will be anything useful in them besides what I'm telling you here (given that I've spent all day staring at them myself).
Terraform Version
v0.11.7
Also repros with v0.11.8-dev (build from source)
Terraform Configuration Files
Expected Behavior
No diff because there's a
DiffSuppressFunc
onnetwork
andsubnetwork
Actual Behavior
Steps to Reproduce
terraform init
terraform apply
terraform plan
Additional Context
Here's what's happening:
Terraform enters into Eval, and calls diff on the provider:
terraform/terraform/eval_diff.go
Lines 116 to 120 in fce30c1
which then calls diff on each of the attributes:
terraform/helper/schema/schema.go
Lines 423 to 428 in fce30c1
In this particular example, the diffs for network and subnetwork are suppressed (as expected), and
node_pool.#
shows a diff because the cluster has two node pools but only one is in the config.Because
node_pool
is aForceNew
field, it setsRequiresNew
on the diff, and because it does that, we hit this block where it empties the state and computes a new diff:terraform/helper/schema/schema.go
Lines 457 to 476 in fce30c1
Now, because the state is empty, our DiffSuppressFunc returns false for network and subnetwork because it's comparing our config against the empty string.
Then, we return from our initial
Diff()
call back intoEval()
, and filter out ignored attributes:terraform/terraform/eval_diff.go
Lines 164 to 167 in fce30c1
This removes the diff on
node_pool
, but leaves in the diff for network and subnetwork, thus producing the plan output seen above.References
hashicorp/terraform-provider-google#988
hashicorp/terraform-provider-google#1566 (where this repro comes from)
hashicorp/terraform-provider-google#1610
The text was updated successfully, but these errors were encountered: