Skip to content
Software capabilities
Terraform

Inspect resources tracked in Terraform state

Use terraform state list to find resource addresses in the current state. Use terraform show -json to inspect a state snapshot when you need structured resource values or module details.

Documentation reviewed · 2 methods with sources

Ways to do it

  1. CLI: terraform state list
  2. CLI: terraform show -json
CLI

terraform state list

Print the addresses Terraform tracks. Supply a resource or module address to narrow the output.

Read source: Terraform state list command reference
Requirements
A Terraform working directory with its state backend configured and permission to read the active workspace’s state.
Limitations
The listing contains resource addresses. Use state show to inspect the attributes of a single resource.

Example shell

terraform state list module.network
CLI

terraform show -json

Read the current state or a supplied state file as JSON. Use the values and module structure to inspect tracked resources in code.

Read source: Terraform show command reference
Requirements
Access to the state and a Terraform installation that can interpret the provider schemas used by the snapshot.
Limitations
Sensitive values in state appear in plaintext in JSON output. Treat the output as sensitive.