Backend initialization required — run terraform init
Backend initialization required: please run "terraform init"
Focused incident mode — strips away everything but this runbook.
Symptoms
- Backend initialization required: please run "terraform init"
- terraform plan fails with backend configuration changed
- After cloning a repo, first terraform command fails
terraform init is required whenever the backend block changes or after a fresh clone. Always run it before plan/apply.
Evidence to grab
Collect these artifacts before you change anything — they prove (or rule out) each cause.
Error message
terraform plan 2>&1 | head -10Current backend config
grep -A10 'backend' *.tf
Diagnostic flow
Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.
Guided decision tree is ready.
Steps with commands, expected output, and pass/fail branches.
Ranked root causes
Evidence checklist
- New backend block added to root module
- Bucket/key/region changed in existing backend block
Confirm before fixing
terraform init 2>&1 | tail -5Run init and check the migration prompt
Fix
terraform init -migrate-stateMigrate state to the new backend
Expected: Successfully configured the backend "s3"
Resolution runbook
Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.
terraform init -migrate-stateInitialize the backend, migrating state if necessary
terraform planVerify the plan runs without init errors
Prevention
- Run terraform init in CI before plan/apply steps.
- Use -backend-config for environment-specific backend settings.
- Document the init step in the repo README for new contributors.
- Use terraform cloud or Atlantis for automated init management.
Related runbooks
Same stack, same failure family — worth a skim.
Error: Unable to find matching value for tag
Error: Error loading state: SyntaxError: JSON input
Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.