Open tjstansell opened 10 months ago
Voting for Prioritization
Volunteering to Work on This Issue
It's actually even worse than this. It appears that AWS orders the rules alphabetically by id. So if you don't have the rules in alphabetical order to begin with, then whenever you refresh the state, including with a plan without setting refresh to false, then you will always get a diff.
I had two environments that had different orders from my terraform code. Removing and re-importing did not help, had to apply the change.
Terraform Core Version
1.6.4
AWS Provider Version
5.26.0
Affected Resource(s)
aws_s3_bucket_lifecycle_configuration
Expected Behavior
When I update the list of rules for a lifecycle configuration, the diff looks at the list of rules as an ordered list. There is no actual ordering to the rules, however, and should be treated as a
ListSet
instead. If I have 3 rules and then add a 4th rule at the top, it shows diffs for any rules moving position in the list instead of just showing that it is adding a new rule.Actual Behavior
When the rule ordering changes, it shows diffs for all rules instead of recognizing that the rules simply got reordered. When code gets refactored and the order happens to change, it is very difficult to parse the plan output to verify that the changes are what are expected. The schema for rules uses a
TypeList
when it seems they should instead be aTypeSet
.Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Original config:
Then add a 4th rule
Steps to Reproduce
If I add the 4th rule at the end of the config, the plan output looks as you'd expect:
However, if the rule is added between rule1 and rule2, I get unexpected plan results:
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
can rules be TypeSet instead?
Would you like to implement a fix?
No