- Backend configuration is read and processed during
terraform init. (Terraform may automatically runinitwhen needed before other commands — for example when the.terraformdirectory is missing.) - Terraform does not evaluate backend configuration during
terraform planorterraform apply; those commands assume an already-initialized backend. - If the backend cannot be initialized during
terraform init, Terraform stops immediately. - Terraform must successfully initialize the backend before it can read state, calculate a plan, or apply changes.
- Backend initialization is a hard prerequisite for all Terraform operations.
- Backend initialization happens once per working directory, not on every run. After a successful
terraform init, Terraform remembers the backend configuration. - The backend is re-initialized only if:
- the backend configuration changes,
- the
.terraformdirectory is removed, or - you run
terraform init -reconfigure.
- In all other cases you do not need to run
terraform initagain.
Backend configuration is processed during initialization. Subsequent operations (plan, apply, refresh, import) all depend on the initialized backend and the state it provides. Terraform may automatically run
terraform init when necessary (for example if the .terraform directory is missing).terraform init interaction (trimmed output):
terraform plan or terraform apply:
- Terraform cannot proceed if backend initialization fails. No state access means no plan and no apply.
- Backend initialization failures are blocking errors — they prevent any further Terraform operations.
- Every plan, apply, refresh, or import depends on a successfully initialized backend.
If you accidentally remove the
.terraform directory or change backend settings without reinitializing, Terraform will require re-running terraform init (or terraform init -reconfigure) before it can access state and continue.
Execution order (always the same)
terraform init— initialize the working directory and backend.- Backend is initialized and state is accessed.
terraform plan— Terraform calculates the proposed changes.terraform apply— Terraform applies the changes.
terraform init (or terraform init -reconfigure) whenever backend settings or local metadata change.
Links and references