diff --git a/helper/diff/diff_test.go b/helper/diff/diff_test.go index 57debc46b..4df4652f2 100644 --- a/helper/diff/diff_test.go +++ b/helper/diff/diff_test.go @@ -58,6 +58,9 @@ func testResourceDiffStr(rd *terraform.ResourceDiff) string { if attrDiff.NewComputed { v = "" } + if attrDiff.NewRemoved { + v = "" + } newResource := "" if attrDiff.RequiresNew { diff --git a/helper/diff/resource_builder.go b/helper/diff/resource_builder.go index 1b03cdac5..c011db1cf 100644 --- a/helper/diff/resource_builder.go +++ b/helper/diff/resource_builder.go @@ -115,9 +115,9 @@ func (b *ResourceBuilder) Diff( } for k, _ := range matchingKeys { attrs[k] = &terraform.ResourceAttrDiff{ - Old: s.Attributes[k], - New: "", - Type: terraform.DiffAttrInput, + Old: s.Attributes[k], + NewRemoved: true, + Type: terraform.DiffAttrInput, } } } diff --git a/helper/diff/resource_builder_test.go b/helper/diff/resource_builder_test.go index 16877111e..6ad8c3dc3 100644 --- a/helper/diff/resource_builder_test.go +++ b/helper/diff/resource_builder_test.go @@ -240,7 +240,7 @@ const testRBComplexDiff = `UPDATE ` const testRBComplexReplaceDiff = `UPDATE - IN listener.0.port: "80" => "" + IN listener.0.port: "80" => "" IN listener.0.value: "" => "50" ` diff --git a/terraform/diff.go b/terraform/diff.go index 6e7f6580d..7a08fb851 100644 --- a/terraform/diff.go +++ b/terraform/diff.go @@ -165,6 +165,7 @@ type ResourceAttrDiff struct { Old string // Old Value New string // New Value NewComputed bool // True if new value is computed (unknown currently) + NewRemoved bool // True if this attribute is being removed NewExtra interface{} // Extra information for the provider RequiresNew bool // True if change requires new resource Type DiffAttrType