hashicorp/terraform · error
errApplyNeedsUIConfirmation
errApplyNeedsUIConfirmation
Error message
Cannot confirm apply due to -input=false. Please handle run confirmation in the UI.
What it means
Returned at backend_apply.go:174 when a cloud-backed run requires interactive confirmation (mustConfirm is true) but the backend's input mode is disabled (!b.input, set by -input=false). Since the run cannot be confirmed locally and the CLI cannot prompt, the error directs the user to handle confirmation in the TFC/TFE UI.
Source
Thrown at internal/cloud/errors.go:22
package cloud
import (
"errors"
"fmt"
"strings"
"github.com/hashicorp/terraform/internal/tfdiags"
"github.com/zclconf/go-cty/cty"
)
// String based errors
var (
errApplyDiscarded = errors.New("Apply discarded.")
errDestroyDiscarded = errors.New("Destroy discarded.")
errRunApproved = errors.New("approved using the UI or API")
errRunDiscarded = errors.New("discarded using the UI or API")
errRunOverridden = errors.New("overridden using the UI or API")
errApplyNeedsUIConfirmation = errors.New("Cannot confirm apply due to -input=false. Please handle run confirmation in the UI.")
errPolicyOverrideNeedsUIConfirmation = errors.New("Cannot override soft failed policy checks when -input=false. Please open the run in the UI to override.")
)
// Diagnostic error messages
var (
invalidWorkspaceConfigMissingValues = tfdiags.AttributeValue(
tfdiags.Error,
"Invalid workspaces configuration",
fmt.Sprintf("Missing workspace mapping strategy. Either workspace \"tags\" or \"name\" is required.\n\n%s", workspaceConfigurationHelp),
cty.Path{cty.GetAttrStep{Name: "workspaces"}},
)
invalidWorkspaceConfigMisconfiguration = tfdiags.AttributeValue(
tfdiags.Error,
"Invalid workspaces configuration",
fmt.Sprintf("Only one of workspace \"tags\" or \"name\" is allowed.\n\n%s", workspaceConfigurationHelp),
cty.Path{cty.GetAttrStep{Name: "workspaces"}},
)View on GitHub (pinned to d32a084675)
Solutions
- Add -auto-approve to your apply command for non-interactive environments.
- Remove -input=false if running interactively and you want the confirmation prompt.
- Handle the run confirmation in the Terraform Cloud UI or via API as the message suggests.
- Configure the workspace for speculative-only or auto-apply in TFC settings.
Example fix
// before terraform apply -input=false // error: Cannot confirm apply due to -input=false // after (option 1: auto-approve) terraform apply -input=false -auto-approve // after (option 2: interactive) terraform apply
Defensive patterns
Strategy: validation
Validate before calling
// Before running terraform apply in CI, check your flags:
// if !interactive && !autoApprove {
// return fmt.Errorf("must use -auto-approve with -input=false")
// }
// Then run: terraform apply -input=false -auto-approve Prevention
- Always pair -input=false with -auto-approve in non-interactive environments.
- Audit CI/CD terraform commands for missing -auto-approve flags.
- Test apply commands locally with the same flags before deploying to CI.
When it happens
Trigger: Running 'terraform apply -input=false' with a cloud backend where the workspace requires run confirmation and -auto-approve was not provided. backend_apply.go:173 checks 'mustConfirm && !b.input' and returns this error instead of attempting a prompt.
Common situations: CI/CD pipelines running terraform apply with -input=false but forgetting -auto-approve; scripts that disable interactive input but expect automatic apply; migrating from local backend to cloud backend where confirmation semantics differ.
Related errors
- errApplyDiscarded
- errRunApproved
- errPolicyOverrideNeedsUIConfirmation
- errDestroyDiscarded
- errRunDiscarded
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/262932f575e5de84.
Report an issue: GitHub.