create a new proposed value when replacing
When replacing an instance, calculate a new proposed value from the null state and the config. This ensures that all unknown values are properly set.
This commit is contained in:
parent
718a3c400a
commit
c9e7346bfd
|
@ -310,11 +310,15 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
|
||||||
// from known prior values to unknown values, unless the provider is
|
// from known prior values to unknown values, unless the provider is
|
||||||
// able to predict new values for any of these computed attributes.
|
// able to predict new values for any of these computed attributes.
|
||||||
nullPriorVal := cty.NullVal(schema.ImpliedType())
|
nullPriorVal := cty.NullVal(schema.ImpliedType())
|
||||||
|
|
||||||
|
// create a new proposed value from the null state and the config
|
||||||
|
proposedNewVal = objchange.ProposedNewObject(schema, nullPriorVal, configVal)
|
||||||
|
|
||||||
resp = provider.PlanResourceChange(providers.PlanResourceChangeRequest{
|
resp = provider.PlanResourceChange(providers.PlanResourceChangeRequest{
|
||||||
TypeName: n.Addr.Resource.Type,
|
TypeName: n.Addr.Resource.Type,
|
||||||
Config: configVal,
|
Config: configVal,
|
||||||
PriorState: nullPriorVal,
|
PriorState: nullPriorVal,
|
||||||
ProposedNewState: configVal,
|
ProposedNewState: proposedNewVal,
|
||||||
PriorPrivate: plannedPrivate,
|
PriorPrivate: plannedPrivate,
|
||||||
})
|
})
|
||||||
// We need to tread carefully here, since if there are any warnings
|
// We need to tread carefully here, since if there are any warnings
|
||||||
|
|
Loading…
Reference in New Issue