{"record":{"id":"9569b942f2087811","repo":"hashicorp/terraform","slug":"input-is-disabled","errorCode":null,"errorMessage":"input is disabled","messagePattern":"input is disabled","errorType":"exception","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/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/meta.go#L642-L678","documentation":"Returned by Meta.confirm() (meta.go:658). confirm() is the shared yes/no helper; it first checks m.Input() (the -input flag) and if input is disabled it returns errors.New(\"input is disabled\") before even prompting. This surfaces when a command path needs confirmation but was invoked non-interactively.","triggerScenarios":"Any command that calls m.confirm() — e.g. confirmation prompts — while running with -input=false, in a non-TTY, or when m.input was set false by automation flags. The caller receives the error instead of a yes/no result.","commonSituations":"Running terraform in CI with -input=false where a code path still invokes confirm(); custom commands/embedding that disable input but trigger a confirmation step.","solutions":["Re-run with input enabled (remove -input=false) if you can answer interactively.","Provide the decision out-of-band: use -auto-approve, -force, or the relevant flag so the confirm path is skipped.","If embedding Terraform, set the equivalent of -auto-approve or avoid calling confirm() in non-interactive contexts."],"exampleFix":"# before\n terraform apply -input=false  # confirm() path hit -> 'input is disabled'\n# after\n terraform apply -auto-approve  # skips confirm entirely","handlingStrategy":"validation","validationCode":"// Before relying on confirm(), check the input flag / TTY.\n if !meta.Input() || !isatty.IsTerminal(os.Stdin.Fd()) {\n     // cannot confirm; pass the appropriate -auto-approve/-force flag instead\n }","typeGuard":null,"tryCatchPattern":"ok, err := meta.confirm(opts)\n if err != nil && strings.Contains(err.Error(), \"input is disabled\") {\n     // re-run with -auto-approve or equivalent\n }","preventionTips":["When running non-interactively, always pass the command's auto-approve/force flag to bypass confirm().","Do not call confirm() in code paths that may run with -input=false."],"tags":["input","non-interactive","confirm","flags"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T21:17:07.882Z"}