sort set/map items to simplify diff
There may be edge cases I’m not thinking of, but in the vast majority of cases I’ve been exposed to the ordering of a set/map is irrelevant and makes diffs unreadable. Please provide the option of viewing a simplified diff where set/map items are ordered to simplify the diff.
- Workaround
- Problem
Log in to comment and vote
Comments4
Black Breeze
Nov 18, 2025
I’m wondering… isn’t there a difference between sets and arrays in Terraform that would be lost if we did the sorting? IIRC in sets, the order is not important. In arrays, it is. The problem is that both are represented the same in JSON so once we get a JSON representation of the diff, we don’t really know which one we’re looking at, and whether sorting is permissible or not.
Please let me validate this with my OpenTofu team though, I may be missing something.