Files
opentf/internal/command/jsonformat/differ/tuple.go
Liam Cervante 46ab53d651 Structured Plan Renderer: Escape object and block keys that don't match HCL syntax (#32483)
* Escape object and block keys that don't match HCL syntax

* address comments
2023-01-09 20:22:59 +01:00

21 lines
639 B
Go

package differ
import (
"github.com/zclconf/go-cty/cty"
"github.com/hashicorp/terraform/internal/command/jsonformat/change"
)
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())
}