Merge pull request #7207 from hashicorp/b-diff-maps

core/diff: Fix attribute mismatch with tags.%
This commit is contained in:
James Nugent 2016-06-24 15:03:36 +03:00 committed by GitHub
commit 1f9a2b241e
2 changed files with 33 additions and 1 deletions

View File

@ -483,7 +483,7 @@ func (d *InstanceDiff) Same(d2 *InstanceDiff) (bool, string) {
// Similarly, in a RequiresNew scenario, a list that shows up in the plan
// diff can disappear from the apply diff, which is calculated from an
// empty state.
if d.RequiresNew() && strings.HasSuffix(k, ".#") {
if d.RequiresNew() && (strings.HasSuffix(k, ".#") || strings.HasSuffix(k, ".%")) {
ok = true
}

View File

@ -636,6 +636,38 @@ func TestInstanceDiffSame(t *testing.T) {
true,
"",
},
{
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"reqnew": &ResourceAttrDiff{
Old: "old",
New: "new",
RequiresNew: true,
},
"somemap.%": &ResourceAttrDiff{
Old: "1",
New: "0",
},
"somemap.oldkey": &ResourceAttrDiff{
Old: "long ago",
New: "",
NewRemoved: true,
},
},
},
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"reqnew": &ResourceAttrDiff{
Old: "",
New: "new",
RequiresNew: true,
},
},
},
true,
"",
},
}
for i, tc := range cases {