From 67aa9441669773d40794d14f38357795468a2156 Mon Sep 17 00:00:00 2001 From: Kristin Laemmert Date: Fri, 30 Nov 2018 15:15:28 -0800 Subject: [PATCH] backend/local: decode variables with cty.DynamicPseudoType Variables values are marshalled with an explicit type of cty.DynamicPseudoType, but were being decoded using `Implied Type` to try and guess the type. This was causing errors because `Implied Type` does not expect to find a late-bound value. --- backend/local/backend_local.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/backend/local/backend_local.go b/backend/local/backend_local.go index 58eee8a28..58bc4f5cb 100644 --- a/backend/local/backend_local.go +++ b/backend/local/backend_local.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform/states/statemgr" "github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/tfdiags" + "github.com/zclconf/go-cty/cty" ) // backend.Local implementation. @@ -219,16 +220,7 @@ func (b *Local) contextFromPlanFile(pf *planfile.Reader, opts terraform.ContextO variables := terraform.InputValues{} for name, dyVal := range plan.VariableValues { - ty, err := dyVal.ImpliedType() - if err != nil { - diags = diags.Append(tfdiags.Sourceless( - tfdiags.Error, - errSummary, - fmt.Sprintf("Invalid value for variable %q recorded in plan file: %s.", name, err), - )) - continue - } - val, err := dyVal.Decode(ty) + val, err := dyVal.Decode(cty.DynamicPseudoType) if err != nil { diags = diags.Append(tfdiags.Sourceless( tfdiags.Error,