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:
James Bardin 2018-10-31 13:44:21 -04:00
parent 718a3c400a
commit 4635ebc61a
1 changed files with 5 additions and 1 deletions

View File

@ -310,11 +310,15 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
// from known prior values to unknown values, unless the provider is
// able to predict new values for any of these computed attributes.
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{
TypeName: n.Addr.Resource.Type,
Config: configVal,
PriorState: nullPriorVal,
ProposedNewState: configVal,
ProposedNewState: proposedNewVal,
PriorPrivate: plannedPrivate,
})
// We need to tread carefully here, since if there are any warnings