From 9c335066a4fd4a3c189f69177c4d1a2a1e73f7f3 Mon Sep 17 00:00:00 2001 From: Kristin Laemmert Date: Fri, 28 Aug 2020 10:28:06 -0400 Subject: [PATCH] backend/local: do not prompt for input vars twice backend, which resulted in users being prompted for input variables twice. This PR fixes that by setting AllowUnsetVariables to true for the state context. Fixes #26027 --- backend/local/backend_local.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/local/backend_local.go b/backend/local/backend_local.go index f460dc652d56..ad82d4bdcc48 100644 --- a/backend/local/backend_local.go +++ b/backend/local/backend_local.go @@ -114,11 +114,14 @@ func (b *Local) context(op *backend.Operation) (*terraform.Context, *configload. // diags from here will be caught above } else { + // WHOOOPS log.Printf("[TRACE] backend/local: building context for current working directory") tfCtx, configSnap, ctxDiags = b.contextDirect(op, opts) // create a validation context with no state - validateCtx, _, _ = b.contextDirect(op, validateOpts) + validateOp := op + validateOp.AllowUnsetVariables = true + validateCtx, _, _ = b.contextDirect(validateOp, validateOpts) // diags from here will be caught above } diags = diags.Append(ctxDiags)