terraform state list command lists resource instances in the Terraform state.
Synopsis
List resources in the state.Usage
aws_instance.examplemodule.examplemodule.example.module.childmodule.example.aws_instance.example
Options
Path to a Terraform state file to use to look up Terraform-managed resources. By default, Terraform will consult the state of the currently-selected workspace.
Filters the results to include only instances whose resource types have an attribute named “id” whose value equals the given id string.
Examples
List all resources
List all resources in the current state:Filter by resource type
List all instances of a specific resource:Filter by module
List all resources in a module:Filter by ID
List resources with a specific ID value:Use custom state file
List resources from a specific state file:Common Use Cases
Inventory resources
Usestate list to get an inventory of all resources managed by Terraform in your workspace.
Identify resources for removal
Before removing resources withterraform state rm, use state list to identify the correct resource addresses.
Verify resource addresses
When moving or manipulating state, usestate list to verify that resource addresses match your expectations.