terraform: MergeDiff removes removed attributes in diff
This commit is contained in:
parent
d111a4c05d
commit
cb52983c84
|
@ -247,6 +247,10 @@ func (s *ResourceState) MergeDiff(d *ResourceDiff) *ResourceState {
|
|||
}
|
||||
if d != nil {
|
||||
for k, diff := range d.Attributes {
|
||||
if diff.NewRemoved {
|
||||
delete(result.Attributes, k)
|
||||
continue
|
||||
}
|
||||
if diff.NewComputed {
|
||||
result.Attributes[k] = config.UnknownVariableValue
|
||||
continue
|
||||
|
|
|
@ -13,6 +13,7 @@ func TestResourceState_MergeDiff(t *testing.T) {
|
|||
ID: "foo",
|
||||
Attributes: map[string]string{
|
||||
"foo": "bar",
|
||||
"port": "8000",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -31,6 +32,9 @@ func TestResourceState_MergeDiff(t *testing.T) {
|
|||
New: "foo",
|
||||
NewComputed: true,
|
||||
},
|
||||
"port": &ResourceAttrDiff{
|
||||
NewRemoved: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue