{"record":{"id":"9569b942f2087811","repo":"hashicorp/terraform","slug":"input-is-disabled","errorCode":null,"errorMessage":"input is disabled","messagePattern":"input is disabled","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/meta.go","lineNumber":660,"sourceCode":"\tif m.View != nil {\n\t\tm.View.Configure(&arguments.View{\n\t\t\tCompactWarnings: m.compactWarnings,\n\t\t\tNoColor:         !m.Color,\n\t\t})\n\t}\n\n\treturn args\n}\n\n// uiHook returns the UiHook to use with the context.\nfunc (m *Meta) uiHook() *views.UiHook {\n\treturn views.NewUiHook(m.View)\n}\n\n// confirm asks a yes/no confirmation.\nfunc (m *Meta) confirm(opts *terraform.InputOpts) (bool, error) {\n\tif !m.Input() {\n\t\treturn false, errors.New(\"input is disabled\")\n\t}\n\n\tfor i := 0; i < 2; i++ {\n\t\tv, err := m.UIInput().Input(context.Background(), opts)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\n\t\t\t\t\"Error asking for confirmation: %s\", err)\n\t\t}\n\n\t\tswitch strings.ToLower(v) {\n\t\tcase \"no\":\n\t\t\treturn false, nil\n\t\tcase \"yes\":\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}","sourceCodeStart":642,"sourceCodeEnd":678,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/meta.go#L642-L678","documentation":"Returned by `Meta.confirm` when it is asked to show a yes/no prompt but `m.Input()` is false (i.e. the process was started with `-input=false` or input was otherwise disabled). The function refuses to prompt and surfaces this error so callers can report that a required confirmation could not be obtained.","triggerScenarios":"Any code path that calls `m.confirm(&terraform.InputOpts{...})` while `m.input == false` — typically because the user passed `-input=false` to a command that needs interactive confirmation.","commonSituations":"Running `terraform apply`/`plan`/`destroy`/state migration in CI with `-input=false` when the command would normally ask for approval; forgetting `-auto-approve` on apply.","solutions":["Pass `-auto-approve` (for apply) or supply the missing approval flag so the command does not need to prompt.","Remove `-input=false` to allow the prompt if you are in an interactive terminal.","Pre-resolve the decision the prompt was going to ask about (e.g. `terraform apply -auto-approve`, or `-force` for migrations)."],"exampleFix":"# before\nterraform apply -input=false   # needs approval -> error\n# after\nterraform apply -input=false -auto-approve","handlingStrategy":"validation","validationCode":"// Equivalent of what callers should check before relying on confirm():\nif !m.Input() {\n    return errors.New(\"input is disabled; pass -auto-approve or remove -input=false\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair `-input=false` with the corresponding auto-approval flag (-auto-approve, -force).","Never call m.confirm() in code paths that may run non-interactively without a fallback.","Test commands with `-input=false` in CI to catch missing approval flags early."],"tags":["input-disabled","interactive","confirm","terraform-cli","ci"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}