From c2dd9a7338f35c8bb7e0a741251a2a01726915c5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Oct 2016 10:02:04 +0800 Subject: [PATCH] terraform: Provier.Diff (shadow) deep copy the config before call --- terraform/shadow_resource_provider.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform/shadow_resource_provider.go b/terraform/shadow_resource_provider.go index 4535660e3..65e5617ef 100644 --- a/terraform/shadow_resource_provider.go +++ b/terraform/shadow_resource_provider.go @@ -172,11 +172,12 @@ func (p *shadowResourceProviderReal) Diff( desired *ResourceConfig) (*InstanceDiff, error) { // Thse have to be copied before the call since call can modify stateCopy := state.DeepCopy() + desiredCopy := desired.DeepCopy() result, err := p.ResourceProvider.Diff(info, state, desired) p.Shared.Diff.SetValue(info.uniqueId(), &shadowResourceProviderDiff{ State: stateCopy, - Desired: desired, + Desired: desiredCopy, Result: result.DeepCopy(), ResultErr: err, })