Terraform
terraform state pull command
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
[!IMPORTANT]
Documentation Update: Product documentation previously located in/website
has moved to thehashicorp/web-unified-docs
repository, where all product documentation is now centralized. Please make contributions directly toweb-unified-docs
, since changes to/website
in this repository will not appear on developer.hashicorp.com. ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
The terraform state pull
downloads and outputs state information from a remote state or local state.
Usage
Usage: terraform state pull
This command downloads the state from its current location, upgrades the local copy to the latest state file version that is compatible with locally-installed Terraform, and outputs the raw format to stdout.
This is useful for reading values out of state (potentially pairing this command with something like jq). It is also useful if you need to make manual modifications to state.
You cannot use this command to inspect the Terraform version of the remote state, as it will always be converted to the current Terraform version before output.
Note: Terraform state files must be in UTF-8 format without a byte order mark (BOM). For PowerShell on Windows, use Set-Content
to automatically encode files in UTF-8 format. For example, run terraform state pull | Set-Content terraform.tfstate
.