2023-01-09 10:39:13 -06:00
|
|
|
package differ
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/zclconf/go-cty/cty"
|
2023-01-09 13:22:59 -06:00
|
|
|
|
|
|
|
"github.com/hashicorp/terraform/internal/command/jsonformat/change"
|
2023-01-09 10:39:13 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
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())
|
|
|
|
}
|