Terraform: Backend configuration changed (tested)

Editing the backend block in your Terraform config — a new path, a new bucket, even a new region — without reinitializing gives this error on the next plan or apply. We changed a local backend's path attribute and measured exactly what each fix flag does to existing state.

1. The exact error

We had state tracked under a local backend, then edited only the path in the backend block:

terraform {
  backend "local" {
    path = "other.tfstate"   # was "terraform.tfstate"
  }
}

Running terraform plan without reinitializing gave, verbatim:

Error: Backend initialization required, please run "terraform init"

Reason: Backend configuration block has changed

The "backend" is the interface that Terraform uses to store state,
perform operations, etc. If this message is showing up, it means that the
Terraform configuration you're using is using a custom configuration for
the Terraform backend.

Changes to backend configurations require reinitialization. This allows
Terraform to set up the new configuration, copy existing state, etc. Please
run "terraform init" with either the "-reconfigure" or "-migrate-state" flags to
use the current configuration.

2. -reconfigure still prompts if old state exists — it doesn't silently discard

We expected -reconfigure to just swap in the new config with no questions. It didn't: with pre-existing state found under the old path, it asked the same interactive question -migrate-state does:

$ terraform init -reconfigure
Initializing the backend...
Do you want to copy existing state to the new backend?
  ...
  Enter a value:

We also tried pairing it with -input=false, expecting that to suppress the prompt and proceed. Instead it hard-errors:

$ terraform init -reconfigure -input=false
Error: Can't ask approval for state migration when interactive input is disabled.

Please remove the "-input=false" option and try again.

Why this matters for CI: if your pipeline runs init non-interactively and a teammate changed the backend path, -reconfigure -input=false is not a safe no-op — it fails the build rather than silently losing state, which is the right failure mode, but it means you can't just bolt `-input=false` onto everything and assume it's handled.

3. The actual non-interactive fix: -migrate-state -force-copy

We confirmed the one combination that both avoids the prompt and preserves existing state:

terraform init -migrate-state -force-copy

This ran cleanly with exit code 0 and no prompt, and terraform state list afterward still showed the resource — the state was copied to the new backend location automatically. -force-copy is documented as "equivalent to answering yes to all confirmation prompts," and that's exactly what we measured: it's the only flag combination here that is both script-safe and state-preserving.

If you genuinely want to abandon old state and start empty at the new location (rare, but sometimes correct for throwaway environments), -reconfigure answered interactively with "no" does that — just don't expect it to skip the question on its own.

Frequently asked questions

What does 'Backend configuration changed' mean in Terraform?

The backend block in your .tf files (path, bucket, region, or any other backend-specific argument) no longer matches what Terraform initialized with last. We reproduced it by changing only a local backend's path attribute and running plan without reinitializing.

Does terraform init -reconfigure skip the state-copy question?

No — we measured that it still prompts interactively if pre-existing state is found at the old location. It also isn't just a reset switch: pairing it with -input=false doesn't suppress the prompt, it hard-errors instead, telling you to remove that flag.

What's the non-interactive way to change a backend in CI without losing state?

terraform init -migrate-state -force-copy — we confirmed this runs with no prompt and exit code 0, and that terraform state list afterward still shows the pre-existing resources, copied to the new backend location.

Is there a way to discard old state and start completely fresh at the new backend?

Yes — we confirmed terraform init -reconfigure, answered 'no' at the interactive copy prompt, initializes the new backend with empty state and leaves the old backend's state file untouched on disk. There's no flag to do this non-interactively, by design, since it's a destructive choice.

Written with AI assistance. Measured on 2026-10-03 with Terraform v1.16.5 on Linux, changing a local backend's path attribute and re-running init with -reconfigure, -migrate-state and -force-copy in combination. Every message below is copy-pasted output, not paraphrased. PlainHeaders is our extension; Terraform is free.