Move state to a newly configured backend during re-init.

Section: Providers and Backend Migration

Migrate state during init

bash
bash
terraform init -migrate-state
Explanation

Move state to a newly configured backend during re-init.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Providers and Backend Migration
Force-copy backend state
Automatically copy existing state to a new backend without prompting.
OpenIn sheetbashsame section
Readonly provider lock file
Use providers from the dependency lock file without updating it.
OpenIn sheetbashsame section
Remote backend snippet
Example backend configuration for HCP Terraform remote state and runs.
OpenIn sheethcl2 tag match
List workspaces
Show available Terraform CLI workspaces for the current configuration.
OpenIn sheetbash1 tag match
Import existing object
Associate an existing infrastructure object with a resource address in state.
OpenIn sheetbash1 tag match
Pull raw state JSON
Download the latest state and write it to a local file.
OpenIn sheetbash1 tag match