Skill 7.2.1

Listing and showing state

Key Concepts

terraform state list prints the address of every resource instance in state, including data sources and module resources. It accepts an address prefix to filter, such as terraform state list module.network, and -id=ID to find the address that manages a given object ID.

terraform state show 'aws_instance.web[0]' prints all attributes of one instance in HCL-like form. These commands read the latest state snapshot and do not refresh it from the real infrastructure, so run a refresh-only plan first if you need current values.