in pkg/terraform/object.go [56:79]
func mergeObjectType(t1, t2 cty.Type) cty.Type {
if t1.IsPrimitiveType() && t2.IsPrimitiveType() {
return t1
}
if t1.IsCollectionType() && t2.IsCollectionType() {
return mergeObjectTypeInCollection(t1, t2)
}
newAttriubtes := make(map[string]cty.Type)
for n, t := range t1.AttributeTypes() {
newAttriubtes[n] = t
}
for n, t := range t2.AttributeTypes() {
if _, ok := newAttriubtes[n]; !ok {
newAttriubtes[n] = t
continue
}
newAttriubtes[n] = mergeObjectType(newAttriubtes[n], t)
}
var allFields []string
for n := range newAttriubtes {
allFields = append(allFields, n)
}
return cty.ObjectWithOptionalAttrs(newAttriubtes, allFields)
}