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

@ -112,7 +112,7 @@ func (p *MockProvider) getSchema() providers.GetSchemaResponse {
// holding the lock.
ret := providers.GetSchemaResponse{
Provider: providers.Schema{},
Provider: providers.Schema{},
DataSources: map[string]providers.Schema{},
ResourceTypes: map[string]providers.Schema{},
}
@ -285,7 +285,7 @@ func (p *MockProvider) PlanResourceChange(r providers.PlanResourceChangeRequest)
legacyDiff, err := p.DiffFn(info, priorState, cfg)
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 {
res.Diagnostics = res.Diagnostics.Append(err)
}
@ -309,7 +309,6 @@ func (p *MockProvider) PlanResourceChange(r providers.PlanResourceChangeRequest)
res.RequiresReplace = requiresReplace
}
return res
}
if p.PlanResourceChangeFn != nil {
return p.PlanResourceChangeFn(r)