hashicorp/terraform · error

input is disabled

Error message

input is disabled

What it means

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.

Source

Thrown at internal/command/meta.go:660

	if m.View != nil {
		m.View.Configure(&arguments.View{
			CompactWarnings: m.compactWarnings,
			NoColor:         !m.Color,
		})
	}

	return args
}

// uiHook returns the UiHook to use with the context.
func (m *Meta) uiHook() *views.UiHook {
	return views.NewUiHook(m.View)
}

// confirm asks a yes/no confirmation.
func (m *Meta) confirm(opts *terraform.InputOpts) (bool, error) {
	if !m.Input() {
		return false, errors.New("input is disabled")
	}

	for i := 0; i < 2; i++ {
		v, err := m.UIInput().Input(context.Background(), opts)
		if err != nil {
			return false, fmt.Errorf(
				"Error asking for confirmation: %s", err)
		}

		switch strings.ToLower(v) {
		case "no":
			return false, nil
		case "yes":
			return true, nil
		}
	}
	return false, nil
}

View on GitHub (pinned to c9def3e214)

Solutions

  1. Re-run with input enabled (remove -input=false) if you can answer interactively.
  2. Provide the decision out-of-band: use -auto-approve, -force, or the relevant flag so the confirm path is skipped.
  3. If embedding Terraform, set the equivalent of -auto-approve or avoid calling confirm() in non-interactive contexts.

Example fix

# before
 terraform apply -input=false  # confirm() path hit -> 'input is disabled'
# after
 terraform apply -auto-approve  # skips confirm entirely
Defensive patterns

Strategy: validation

Validate before calling

// Before relying on confirm(), check the input flag / TTY.
 if !meta.Input() || !isatty.IsTerminal(os.Stdin.Fd()) {
     // cannot confirm; pass the appropriate -auto-approve/-force flag instead
 }

Try / catch

ok, err := meta.confirm(opts)
 if err != nil && strings.Contains(err.Error(), "input is disabled") {
     // re-run with -auto-approve or equivalent
 }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07). Data as JSON: /api/errors/9569b942f2087811. Report an issue: GitHub.