mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
20 lines
638 B
Go
20 lines
638 B
Go
|
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())
|
||
|
}
|