mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
Marshal plan#relevant_attributes in deterministic order (#327)
Signed-off-by: Marcin Wyszynski <marcin.pixie@gmail.com>
This commit is contained in:
@@ -682,6 +682,13 @@ func (p *Plan) marshalRelevantAttrs(plan *plans.Plan) error {
|
||||
|
||||
p.RelevantAttributes = append(p.RelevantAttributes, ResourceAttr{addr, path})
|
||||
}
|
||||
|
||||
// We sort the relevant attributes by resource address to make the output
|
||||
// deterministic. Our own equivalence tests rely on it.
|
||||
sort.Slice(p.RelevantAttributes, func(i, j int) bool {
|
||||
return p.RelevantAttributes[i].Resource < p.RelevantAttributes[j].Resource
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user