plans: ChangesSync.GetResourceInstanceChange must copy the change

This is promised in its doc comment, but wasn't actually done in practice.
This commit is contained in:
Martin Atkins 2018-08-27 16:51:26 -07:00
parent c27f900d92
commit 2f0e5d93c8
1 changed files with 2 additions and 2 deletions

View File

@ -54,10 +54,10 @@ func (cs *ChangesSync) GetResourceInstanceChange(addr addrs.AbsResourceInstance,
defer cs.lock.Unlock()
if gen == states.CurrentGen {
return cs.changes.ResourceInstance(addr)
return cs.changes.ResourceInstance(addr).DeepCopy()
}
if dk, ok := gen.(states.DeposedKey); ok {
return cs.changes.ResourceInstanceDeposed(addr, dk)
return cs.changes.ResourceInstanceDeposed(addr, dk).DeepCopy()
}
panic(fmt.Sprintf("unsupported generation value %#v", gen))
}