Merge pull request #9776 from hashicorp/b-schema-computed

terraform: NewComputed doesn't quit Same logic
This commit is contained in:
Mitchell Hashimoto 2016-11-01 10:06:29 -07:00 committed by GitHub
commit 7db209d791
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{