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 {
|
||||
// schema.Provider.Diff returns nil if it ends up making a diff with
|
||||
// no changes, but our new interface wants us to return an actual
|
||||
// change description that _shows_ there are no changes, so we return
|
||||
// the proposed change that produces no diff.
|
||||
// schema.Provider.Diff returns nil if it ends up making a diff with no
|
||||
// changes, but our new interface wants us to return an actual change
|
||||
// description that _shows_ there are no changes. This is usually the
|
||||
// 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
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue