{"record":{"id":"262932f575e5de84","repo":"hashicorp/terraform","slug":"errapplyneedsuiconfirmation","errorCode":"errApplyNeedsUIConfirmation","errorMessage":"Cannot confirm apply due to -input=false. Please handle run confirmation in the UI.","messagePattern":"Cannot confirm apply due to -input=false\\. Please handle run confirmation in the UI\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/errors.go","lineNumber":22,"sourceCode":"package cloud\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/hashicorp/terraform/internal/tfdiags\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\n// String based errors\nvar (\n\terrApplyDiscarded                    = errors.New(\"Apply discarded.\")\n\terrDestroyDiscarded                  = errors.New(\"Destroy discarded.\")\n\terrRunApproved                       = errors.New(\"approved using the UI or API\")\n\terrRunDiscarded                      = errors.New(\"discarded using the UI or API\")\n\terrRunOverridden                     = errors.New(\"overridden using the UI or API\")\n\terrApplyNeedsUIConfirmation          = errors.New(\"Cannot confirm apply due to -input=false. Please handle run confirmation in the UI.\")\n\terrPolicyOverrideNeedsUIConfirmation = errors.New(\"Cannot override soft failed policy checks when -input=false. Please open the run in the UI to override.\")\n)\n\n// Diagnostic error messages\nvar (\n\tinvalidWorkspaceConfigMissingValues = tfdiags.AttributeValue(\n\t\ttfdiags.Error,\n\t\t\"Invalid workspaces configuration\",\n\t\tfmt.Sprintf(\"Missing workspace mapping strategy. Either workspace \\\"tags\\\" or \\\"name\\\" is required.\\n\\n%s\", workspaceConfigurationHelp),\n\t\tcty.Path{cty.GetAttrStep{Name: \"workspaces\"}},\n\t)\n\n\tinvalidWorkspaceConfigMisconfiguration = tfdiags.AttributeValue(\n\t\ttfdiags.Error,\n\t\t\"Invalid workspaces configuration\",\n\t\tfmt.Sprintf(\"Only one of workspace \\\"tags\\\" or \\\"name\\\" is allowed.\\n\\n%s\", workspaceConfigurationHelp),\n\t\tcty.Path{cty.GetAttrStep{Name: \"workspaces\"}},\n\t)","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/cloud/errors.go#L4-L40","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nterraform apply -input=false\n// error: Cannot confirm apply due to -input=false\n\n// after (option 1: auto-approve)\nterraform apply -input=false -auto-approve\n// after (option 2: interactive)\nterraform apply","handlingStrategy":"validation","validationCode":"// Before running terraform apply in CI, check your flags:\n// if !interactive && !autoApprove {\n//     return fmt.Errorf(\"must use -auto-approve with -input=false\")\n// }\n// Then run: terraform apply -input=false -auto-approve","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["terraform","cloud","apply","input-mode","ci-cd","confirmation"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}