ignore_changes changing a null map to empty
Fix an error where using `ignore_changes` would cause some null maps to be saved as an empty map.
This commit is contained in:
parent
64635edfb9
commit
40174b634a
|
@ -1289,10 +1289,15 @@ func processIgnoreChangesIndividual(prior, config cty.Value, ignoreChangesPath [
|
|||
}
|
||||
|
||||
var newVal cty.Value
|
||||
if len(configMap) == 0 {
|
||||
newVal = cty.MapValEmpty(v.Type().ElementType())
|
||||
} else {
|
||||
switch {
|
||||
case len(configMap) > 0:
|
||||
newVal = cty.MapVal(configMap)
|
||||
case v.IsNull():
|
||||
// if the config value was null, and no values remain in the map,
|
||||
// reset the value to null.
|
||||
newVal = v
|
||||
default:
|
||||
newVal = cty.MapValEmpty(v.Type().ElementType())
|
||||
}
|
||||
|
||||
if len(vMarks) > 0 {
|
||||
|
|
Loading…
Reference in New Issue