From 2f0e5d93c86f5a0e61f61d43af67c0defd4c347d Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Mon, 27 Aug 2018 16:51:26 -0700 Subject: [PATCH] plans: ChangesSync.GetResourceInstanceChange must copy the change This is promised in its doc comment, but wasn't actually done in practice. --- plans/changes_sync.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plans/changes_sync.go b/plans/changes_sync.go index f5bfb1afb..10d7225c1 100644 --- a/plans/changes_sync.go +++ b/plans/changes_sync.go @@ -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)) }