From 9967641c4b98934e7a94579e3cbaa90e9d373407 Mon Sep 17 00:00:00 2001 From: clint shryock Date: Thu, 16 Jun 2016 18:22:21 -0500 Subject: [PATCH] core/diff: Fix attribute mismatch with tags.% --- terraform/diff.go | 2 +- terraform/diff_test.go | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/terraform/diff.go b/terraform/diff.go index 8c26e16ff..afd64d3f7 100644 --- a/terraform/diff.go +++ b/terraform/diff.go @@ -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 } diff --git a/terraform/diff_test.go b/terraform/diff_test.go index 926a093d4..52026095c 100644 --- a/terraform/diff_test.go +++ b/terraform/diff_test.go @@ -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 {