Skip to content
Latchkey

Terraform "backend configuration ... has changed" / Missing -backend-config in CI

Your backend block leaves values to be filled in at init time (a partial configuration), but CI did not pass them - so Terraform either prompts (and fails non-interactively) or records an inconsistent backend.

What this error means

terraform init -input=false fails because a partial backend needs values it was not given - the bucket or key is empty - or it reports the configured backend has changed because different -backend-config values were passed than last time.

terraform init output
Error: "bucket": required field is not set

Error: Initialization required. Please see the error message above.

# with -input=false, Terraform cannot prompt for the missing backend values.

Common causes

Partial backend values not supplied

A backend block intentionally omits values (bucket/key/region) to inject per-environment. With -input=false and no -backend-config, the required fields are unset.

Inconsistent values between runs

Passing different -backend-config values than a cached .terraform/ recorded makes init report the backend configuration changed.

How to fix it

Pass the backend values at init

Supply every partial value via -backend-config (inline or a file) so non-interactive init has what it needs.

Terminal
terraform init -input=false \
  -backend-config="bucket=my-tf-state" \
  -backend-config="key=prod/app/terraform.tfstate" \
  -backend-config="region=us-east-1"

Reconfigure when values change per environment

When the same working directory targets different environments, add -reconfigure so init accepts the new backend values.

Terminal
terraform init -reconfigure -backend-config=env/prod.s3.tfbackend

How to prevent it

  • Keep partial backend values in per-environment *.tfbackend files passed via -backend-config.
  • Always run init with -input=false in CI so missing values fail fast.
  • Use -reconfigure when one directory targets multiple backends.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →