From 4635ebc61aafbe769a83c7d02114cf1629b599d4 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 31 Oct 2018 13:44:21 -0400 Subject: [PATCH] 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. --- terraform/eval_diff.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/terraform/eval_diff.go b/terraform/eval_diff.go index 0b6c4aff3..50bb5ea3b 100644 --- a/terraform/eval_diff.go +++ b/terraform/eval_diff.go @@ -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