Skip to content

Commit

Permalink
backend/local: do not prompt for input vars twice
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mildwonkey committed Aug 28, 2020
1 parent 0e93ed4 commit 9c33506
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/local/backend_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9c33506

Please sign in to comment.