terraform init ai_generated true

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

ID: terraform/backend-initialization-required

Also available as: JSON · Markdown
98%Fix Rate
98%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
115 active

Root Cause

Terraform backend configuration changed but terraform init wasn't run to apply the change.

generic

Workarounds

  1. 97% success Run terraform init to initialize the new backend
    Terraform will prompt to migrate state if the backend changed

    Sources: https://developer.hashicorp.com/terraform/cli/commands/init

  2. 93% success Use terraform init -migrate-state to move state between backends
    Safely copies state from old backend to new backend during init

Dead Ends

Common approaches that don't work:

  1. Manually editing .terraform directory files 85% fail

    May corrupt the local state cache

  2. Copying state files between backends manually 75% fail

    Easy to lose state or corrupt it; use terraform init -migrate-state instead

Error Chain

Frequently confused with: