TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/hashicorp/terraform/llms.txt
Use this file to discover all available pages before exploring further.
terraform state pull command downloads the current state and outputs it to stdout.
Synopsis
Pull current state and output to stdout.Usage
Options
This command has no command-specific options. It uses the backend configuration from your Terraform configuration.Examples
Pull and view state
Pull the current state and view it:Save state to a file
Pull state and save it to a local file:View formatted state
Pull and format state with jq:Extract specific information
Pull state and extract specific resource information:Check state version
View the Terraform version used to write the state:List all resource types
Extract all resource types from the state:Get resource count
Count total resources in state:Common Use Cases
Backup remote state
Create a local backup of your remote state file:Inspect remote state
Examine the contents of your remote state without downloading it as a file.State migration
Pull state from one backend as part of migrating to a different backend:Debug state issues
Inspect the raw state format to debug issues with resources or state structure.Scripting and automation
Use in scripts to extract information about your infrastructure:Verify state format
Check the state file version and ensure it’s compatible with your Terraform version.Extract outputs programmatically
Get output values from state for use in other tools:Important Notes
- The output is in JSON format (Terraform state file format)
- This is a read-only operation; it doesn’t modify the state
- The state format may be upgraded to match your current Terraform version
- For remote backends, this downloads the current state snapshot
- The output includes sensitive data; be careful when redirecting to files or sharing