core/diff: Fix attribute mismatch with tags.%

This commit is contained in:
clint shryock 2016-06-16 18:22:21 -05:00
parent f65a898a51
commit 9967641c4b
2 changed files with 33 additions and 1 deletions

View File

@ -488,7 +488,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

@ -595,6 +595,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 {