return proper PlanResourceChange in mock

This commit is contained in:
James Bardin 2018-10-08 14:06:43 -04:00 committed by Martin Atkins
parent 52c0032aed
commit 7e0fc55b80
1 changed files with 2 additions and 3 deletions

View File

@ -285,7 +285,7 @@ func (p *MockProvider) PlanResourceChange(r providers.PlanResourceChangeRequest)
legacyDiff, err := p.DiffFn(info, priorState, cfg) legacyDiff, err := p.DiffFn(info, priorState, cfg)
var res providers.PlanResourceChangeResponse var res providers.PlanResourceChangeResponse
res.PlannedState = cty.NullVal(schema.ImpliedType()) // mimic how an absent value would arrive over the GRPC channel res.PlannedState = r.ProposedNewState
if err != nil { if err != nil {
res.Diagnostics = res.Diagnostics.Append(err) res.Diagnostics = res.Diagnostics.Append(err)
} }
@ -309,7 +309,6 @@ func (p *MockProvider) PlanResourceChange(r providers.PlanResourceChangeRequest)
res.RequiresReplace = requiresReplace res.RequiresReplace = requiresReplace
} }
return res return res
} }
if p.PlanResourceChangeFn != nil { if p.PlanResourceChangeFn != nil {
return p.PlanResourceChangeFn(r) return p.PlanResourceChangeFn(r)