Skip to content

Commit

Permalink
create a new proposed value when replacing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jbardin committed Oct 31, 2018
1 parent 718a3c4 commit 4635ebc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion terraform/eval_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4635ebc

Please sign in to comment.