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:
Mitchell Hashimoto 2016-11-01 09:53:53 -07:00
parent 3630bb0e3f
commit df981b234d
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
2 changed files with 29 additions and 1 deletions

View File

@ -615,7 +615,7 @@ func (d *InstanceDiff) Same(d2 *InstanceDiff) (bool, string) {
// that value is allowed since it may mean the value ended up
// being the same.
if diffOld.NewComputed {
continue
ok = true
}
// No exact match, but maybe this is a set containing computed

View File

@ -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{
Attributes: map[string]*ResourceAttrDiff{