terraform: NewComputed doesn't quit Same logic
For #9618, we added the ability to ignore old diffs that were computed and removed (because the ultimate value ended up being the same). This ended up breaking computed list/set logic. The correct behavior, as is evident by how the other "skip" logics work, is to set `ok = true` so that the remainder of the logic can run which handles stuff such as computed lists and sets.
This commit is contained in:
parent
3630bb0e3f
commit
df981b234d
|
@ -615,7 +615,7 @@ func (d *InstanceDiff) Same(d2 *InstanceDiff) (bool, string) {
|
||||||
// that value is allowed since it may mean the value ended up
|
// that value is allowed since it may mean the value ended up
|
||||||
// being the same.
|
// being the same.
|
||||||
if diffOld.NewComputed {
|
if diffOld.NewComputed {
|
||||||
continue
|
ok = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// No exact match, but maybe this is a set containing computed
|
// No exact match, but maybe this is a set containing computed
|
||||||
|
|
|
@ -608,6 +608,34 @@ func TestInstanceDiffSame(t *testing.T) {
|
||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// NewComputed on set, removed
|
||||||
|
{
|
||||||
|
&InstanceDiff{
|
||||||
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
|
"foo.#": &ResourceAttrDiff{
|
||||||
|
Old: "",
|
||||||
|
New: "",
|
||||||
|
NewComputed: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
&InstanceDiff{
|
||||||
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
|
"foo.1": &ResourceAttrDiff{
|
||||||
|
Old: "foo",
|
||||||
|
New: "",
|
||||||
|
NewRemoved: true,
|
||||||
|
},
|
||||||
|
"foo.2": &ResourceAttrDiff{
|
||||||
|
Old: "",
|
||||||
|
New: "bar",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
"",
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
&InstanceDiff{
|
&InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
|
|
Loading…
Reference in New Issue