if there is no plan diff, prefer the prior state
The prior state may contain customizations made by the provider. If there is no prior state, then take the proposed state.
This commit is contained in:
parent
36cede09f7
commit
e0ea2a5d06
|
@ -476,11 +476,16 @@ func (s *GRPCProviderServer) PlanResourceChange(_ context.Context, req *proto.Pl
|
||||||
}
|
}
|
||||||
|
|
||||||
if diff == nil {
|
if diff == nil {
|
||||||
// schema.Provider.Diff returns nil if it ends up making a diff with
|
// schema.Provider.Diff returns nil if it ends up making a diff with no
|
||||||
// no changes, but our new interface wants us to return an actual
|
// changes, but our new interface wants us to return an actual change
|
||||||
// change description that _shows_ there are no changes, so we return
|
// description that _shows_ there are no changes. This is usually the
|
||||||
// the proposed change that produces no diff.
|
// PriorSate, however if there was no prior state and no diff, then we
|
||||||
|
// use the ProposedNewState.
|
||||||
|
if !priorStateVal.IsNull() {
|
||||||
|
resp.PlannedState = req.PriorState
|
||||||
|
} else {
|
||||||
resp.PlannedState = req.ProposedNewState
|
resp.PlannedState = req.ProposedNewState
|
||||||
|
}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue