helper/diff: mark removed keys as removed

This commit is contained in:
Mitchell Hashimoto 2014-07-09 09:51:36 -07:00
parent 2d97738636
commit 96e09440d4
4 changed files with 8 additions and 4 deletions

View File

@ -58,6 +58,9 @@ func testResourceDiffStr(rd *terraform.ResourceDiff) string {
if attrDiff.NewComputed {
v = "<computed>"
}
if attrDiff.NewRemoved {
v = "<removed>"
}
newResource := ""
if attrDiff.RequiresNew {

View File

@ -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,
}
}
}

View File

@ -240,7 +240,7 @@ const testRBComplexDiff = `UPDATE
`
const testRBComplexReplaceDiff = `UPDATE
IN listener.0.port: "80" => ""
IN listener.0.port: "80" => "<removed>"
IN listener.0.value: "" => "50"
`

View File

@ -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