-
Notifications
You must be signed in to change notification settings - Fork 233
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
d.HasChange() is returning true for elements that have not actually changed #98
Comments
Hi @danawillow! Sorry for this odd behavior... I have a suspicion that the If you print that out using This code is going to get an overhaul soon as part of introducing the type system associated with the improved configuration language, and that ought to help with some of the trickier parts of |
Thanks @apparentlymart! This is a fun one :)
|
Ahh, so literally the only change is the address of the Fortunately, this was enough to give me a lead which led to an explanation: We have this Unfortunately in this case the set is in a nested structure, so the top-level It seems like the answer here would be to rewrite the equality checker to support all types and not use Fortunately we'll be embarking on this work soon (design/planning for it is in progress as I write this) so it shouldn't be too long before we can get a fix here. In the mean time, I suspect it could be worked around by retrieving the values and doing the deep-compare yourself in the provider code; as long as you are careful to use |
Thanks for the explanation! Looking forward to the new type system :) |
Hey @apparentlymart, this still seem to be happening with Terraform 0.12. I was trying to fix hashicorp/terraform-provider-vault#469 by adding
Not sure what I can do about this. Edit: Worked around it by doing the comparison manually. |
I've encountered this as well, causing hashicorp/terraform-provider-google#4411. Diff from spew is at https://www.diffchecker.com/sMzxWDn3 (caveat: I rearranged the fields + modified some timestamps so they diffed cleanly). Interestingly, the diff seems to persist when the Edit: Also fwiw, my experience was with |
0.12 did introduce new type system which is mentioned here, but the way it's currently exposed to providers is through shim layers, which effectively means that the new "enriched" This is the likely reason it's still reproducible in 0.12 - correct me if I'm wrong @apparentlymart We are in active talks currently about how we could expose these new types and what impact would it have on existing (arguably limited) interface which is exposed to providers today (e.g. If you are interested in more technical details I believe this is the main place where all the data gets converted back and forth: |
Yes, I'd expect that this bug is still present, for the reason @radeksimko stated. FWIW, my earlier comment about the potential to fix this with the new type system was made before we'd done significant work on what turned out to be quite a substantial amount of shim code to preserve (as closely as possible) old behaviors. While what I said is still broadly true -- comparing sets with |
#362 may mitigate and resolve this in certain scenarios. |
I believe this should be resolved by #711, which was recently merged and will be released with version 2.9.0. If there are still issues after that, please file a new bug report and we can take a fresh look. Thank you! |
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. |
Terraform Version
Terraform Configuration Files
Debug Output
https://gist.github.com/danawillow/fac76b10939fab4a31112108e70bbf37
Note the extra statements I added at the end:
Expected Behavior
Only the tags should have updated
Actual Behavior
The tags did update, but
d.HasChange("service_account")
returned true, causing Terraform to try to update the service account as well.Steps to Reproduce
Use config above
terraform init
terraform apply
terraform apply
Additional Context
None.
References
Originally reported at hashicorp/terraform-provider-google#1108, though the real bug appears to be in core and not the provider.
The text was updated successfully, but these errors were encountered: