Commit Graph

4 Commits

Author SHA1 Message Date
James Bardin f959b560a2 trim index steps from RequiresNew paths
Only GetAttrSteps can actually trigger RequiresNew, but the flatmaps
paths will point to the indexed value that caused the change.
2018-10-31 13:40:01 -04:00
James Bardin f4416ee1df update the new RequiresReplace function
Make the function work specifically how we need for RequiresReplace.
Skip index changes, any set changes are only recorded as the set itself,
and filter out duplicate paths.

Add a few more tests to check for various nested structures.
2018-10-16 18:53:51 -07:00
James Bardin 30ff37f335 change PathFromFlatmapKey to RequiresReplace
Rather than try and make a generalized path function here, what we
really need in a function to generate the paths needed for
RequiresReplace. This needs to take into account that sets elements
don't need to be indexed themselves, and changes to collection index
values aren't needed.
2018-10-16 18:53:51 -07:00
James Bardin 44e993ec29 add hcl2shim.PathFromFlatmapKey
PathFromFlatmapKey is used to convert a flatmap key to a cty.Path, and
ensures it conforms to the type schema.

This is used when handling Diffs, where the ResourceAttrDiffs are
indexed by the flatmapped key values, and we need to convert those to
addresses to apply to a cty.Value.
2018-10-16 18:53:51 -07:00