DiffSuppressFunc should noop diffs in sets
Sets rely on diffs being complete for all elements, even when they are unchanged. When encountering a DiffSuppressFunc inside a set the diffs were being dropped entirely, possible causing set elements to be lost.
This commit is contained in:
parent
2e2374cfcb
commit
81a4e705b1
|
@ -799,11 +799,20 @@ func (m schemaMap) diff(
|
|||
for attrK, attrV := range unsupressedDiff.Attributes {
|
||||
switch rd := d.(type) {
|
||||
case *ResourceData:
|
||||
if schema.DiffSuppressFunc != nil &&
|
||||
attrV != nil &&
|
||||
if schema.DiffSuppressFunc != nil && attrV != nil &&
|
||||
schema.DiffSuppressFunc(attrK, attrV.Old, attrV.New, rd) {
|
||||
// If this attr diff is suppressed, we may still need it in the
|
||||
// overall diff if it's contained within a set. Rather than
|
||||
// dropping the diff, make it a NOOP.
|
||||
if !all {
|
||||
continue
|
||||
}
|
||||
|
||||
attrV = &terraform.ResourceAttrDiff{
|
||||
Old: attrV.Old,
|
||||
New: attrV.Old,
|
||||
}
|
||||
}
|
||||
}
|
||||
diff.Attributes[attrK] = attrV
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue