Serialize AttrSensitivePaths
in a consistent order
#36465
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sensitive paths in a resource instance value were not serialized in a consistent order, which could cause comparison of the state to erroneously indicate a change. While the UI would not report any changes to the user because the states were functionally the same, the machine readable outputs, like the plan `applyable' field and the detailed exitcode would indicate that the plan was not empty.
The canonical user-readable version of a cty.Path is was created by the tfdiags package, but in order to reuse this everywhere we need, the formatting function needs to be split out to it's own package. This PR creates the
lang/format
package, delegates thetfgdiags
format functions to the new package, then replaces any otherfmt.Sprintf
formatting ofcty.Path
I could find with the new more efficient formatter.Once we have a single format for
cty.Path
, use that to sort theAttrSensitivePaths
used in state so that the order is deterministic.Fixes #36403