Terraform Workspaces and State Cheat Sheet/Plan with alternate state path

Use a non-default local state path for commands that support it.

Section: Remote State Patterns

Plan with alternate state path

bash
bash
terraform plan -state=terraform.tfstate
Explanation

Use a non-default local state path for commands that support it.

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 Remote State Patterns
Ignore files for remote runs
Exclude paths from uploaded configuration when using remote CLI-driven runs.
OpenIn sheetgitignoresame section
Remote backend snippet
Example backend configuration for HCP Terraform remote state and runs.
OpenIn sheethclsame section
Import existing object
Associate an existing infrastructure object with a resource address in state.
OpenIn sheetbash2 tag match
Pull raw state JSON
Download the latest state and write it to a local file.
OpenIn sheetbash2 tag match
Push raw state JSON
Upload a local state file into the configured backend.
OpenIn sheetbash2 tag match
Move state address
Rename or move a resource address in state.
OpenIn sheetbash2 tag match