terraform: Provier.Diff (shadow) deep copy the config before call

This commit is contained in:
Mitchell Hashimoto 2016-10-09 10:02:04 +08:00
parent 817979c56d
commit c2dd9a7338
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 2 additions and 1 deletions

View File

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