Skip to content

Commit

Permalink
streaming: handle partially defined namespace policy maps
Browse files Browse the repository at this point in the history
  • Loading branch information
pgier committed Jan 23, 2024
1 parent 878b8e5 commit dc4e86b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/provider/util_terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func CompareTerraformAttrToString(attr attr.Value, s string) bool {
}

// MergeTerraformObjects combines two Terraform Objects replacing any null or unknown attribute values in `old` with
// matching attributes from `new`. Object type attributes are handled recursively to avoid overriding existing
// matching attributes from `new`. Object type attributes are handled recursively to avoid overwriting existing
// nested attributes in the old Object. Full type information must be specified.
//
// The reason for this function is to handle situations where a remote resource was created but not all configuration
Expand Down Expand Up @@ -78,6 +78,14 @@ func MergeTerraformObjects(old, new types.Object, attributeTypes map[string]attr
}
attributes[name] = newObjValue
continue
} else if _, ok := oldValue.(basetypes.MapValue); ok {
newMapValue, ok := newValue.(basetypes.MapValue)
if !ok {
diags.AddWarning("Missing type information for attribute "+name, "No type information found when merging objects")
continue
}
attributes[name] = newMapValue
continue
}

attributes[name] = oldValue
Expand Down

0 comments on commit dc4e86b

Please sign in to comment.