terraform state list— list resource addresses recorded in the stateterraform state show— display detailed attributes for a single resource in the state
terraform show (without the state subcommand) to print an entire state file or a saved plan file. Use terraform state show <ADDRESS> when you want details about a single resource recorded in the current state.
Use
terraform show to dump a full state or plan file. Use terraform state show <ADDRESS> when you want a focused view of one resource from the current state.Quick reference — commands
1. List resources in the state
Runterraform state list to see all resource addresses Terraform currently tracks:
terraform state show for more detail. For example, to inspect the EC2 instance attributes you would use aws_instance.web.
2. Inspect the entire state (terraform show)
terraform show prints the contents of the current state or a plan file. This is useful for a broad overview but can be verbose. Example (truncated):
terraform show dumps everything, it’s often easier to inspect a single resource with terraform state show.
3. Inspect a single resource (terraform state show)
First runterraform state list to find the exact address you want. Then run:
aws_instance.web:
aws_subnet.private:
terraform state list to locate the exact address, then terraform state show <address> to retrieve that resource’s details. This is the fastest way to inspect state for a single resource.
Tip: Pipe
terraform state list into tools like grep to quickly find resources, for example: terraform state list | grep aws_instance.