terraform-provider-aws: "Objects changed outside of Terraform" shown wrongly for various resources
Community Note
- Please vote on this issue by adding a π reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave β+1β or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Please open a new issue
- Since this issue was opened on Jun 9, 2021, we have had two major rounds of fixes (#21968, #23288 and #28836 et al.) that seem to have improved and/or eliminated changed reports being shown wrongly
- In order to alert maintainers and the community to what is still not working, open a new issue with a title similar to
[Bug]: ec2/instance objects have changed outside of Terraform. Check to make sure one doesnβt already exist for the resource you are working on.
Terraform CLI and Terraform AWS Provider Version
terraform version: 1.0.0
aws provider version: 3.44.0
Affected Resource(s)
Related to jsonencode list items ordering
- aws_s3_bucket_policy
- aws_iam_role
Related to latest_restorable_time attribute with drifts
- aws_db_instance
and more
Expected Behavior
No change was made outside of terraform so these should not be visible there as well
Actual Behavior
Terraform thinks that something was changed outside terraform (which is not the case)
References
This issue was first submitted in https://github.com/hashicorp/terraform/issues/28911
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 142
- Comments: 26 (8 by maintainers)
Is there any plan to do something about this? π€
Also affects
aws_kms_keyresources - the policy statement principals are changing order:Also affects
aws_wafv2_web_aclresources; it is unclear why, as the attributes list shows no changes. Applying the refresh plan has no effect βΒ it will still be marked as changed in the next plan.Observed on provider version
v3.45.0.I confirm itβs still the case with
aws_wafv2_web_acl(provider version3.69.0).Terraform detected the following changes made outside of Terraform since the last βterraform applyβ:
Iβm seeing an
aws_iam_rolepolicy as changed without even having a list being reordered, or any other change visibly pointed out. Terraform apparently includes# whitespace changesin the output when this happens.The
aws_backup_vaultresource is affected as well:This seems to affect anything with a policy. The principal list appears to come back in a non-deterministic order.
For reference, the original issue left open since June 2021 https://github.com/hashicorp/terraform/issues/28803
This also affects things that change outside of Terraform, but which youβve told Terraform to ignore.
Two places weβve seen that are (1) tags in a lifecycle ignore_changes list; and (2) when an ELB isnβt configured in Terraform to have listeners, because we have separate orchestration tools that add and remove them. In both of those cases, Terraform used to not show changes when those things changed behind the scenes, but now it does.
Iβm not sure if thatβs a provider side thing that fits with this ticket, or if the ignored-changes problem belongs with https://github.com/hashicorp/terraform/issues/28803.
@gilad9366 Please open an issue for
aws_autoscaling_groupif this is still an issue so that we can prioritize and get eyes on that specific problem.@nantiferov I would love to hear back from you if you are still facing problems with drift using
v4.50.0. Please see #23288.According to this comment, since v1.2 (not released yet) it should became kinda better https://github.com/hashicorp/terraform/issues/28803#issuecomment-1072740861
P.S. Btw, sed could be used to cut off this nice feature (macOS example), filter in realtime (i.e. you donβt have to wait till terraform finish), works with apply too, as stdin not affected.
P.P.S. Also I wrote an article some time ago how to hide this stuff with python wrapper https://nklya.medium.com/fix-objects-have-changed-outside-of-terraform-with-invoke-wrapper-7b73fa2e99a0
I am seeing this issue with aws_wafv2_web_acl with AWS provider 3.74.0 and terraform 1.1.5.
Yes, we got hit with exactly this π
@nantiferov I ended up in this thread for issues exactly like what you have described, but upgrading to TF v1.2.1 and AWS provider 4.16.0 has removed the output which I was also getting with every plan previously.
Hi everyone, is there some news about this ? Thanks in advance ?