mirror of https://github.com/hashicorp/terraform
Add support for Tuples into the structured plan renderer (#32479)
* add support for tuples to the structured plan renderer * update after latest main changesbackport/patch-1/fully-fine-macaw
parent
2d66eee872
commit
d31631675b
@ -0,0 +1,19 @@
|
||||
package differ
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform/internal/command/jsonformat/change"
|
||||
"github.com/zclconf/go-cty/cty"
|
||||
)
|
||||
|
||||
func (v Value) computeAttributeChangeAsTuple(elementTypes []cty.Type) change.Change {
|
||||
var elements []change.Change
|
||||
current := v.getDefaultActionForIteration()
|
||||
sliceValue := v.asSlice()
|
||||
for ix, elementType := range elementTypes {
|
||||
childValue := sliceValue.getChild(ix, ix, false)
|
||||
element := childValue.computeChangeForType(elementType)
|
||||
elements = append(elements, element)
|
||||
current = compareActions(current, element.Action())
|
||||
}
|
||||
return change.New(change.List(elements), current, v.replacePath())
|
||||
}
|
||||
Loading…
Reference in new issue