The terraform state list
command is used to list resources within a Terraform state.
Usage: terraform state list [options] [address...]
The command will list all resources in the state file matching the given addresses (if any). If no addresses are given, all resources are listed.
The resources listed are sorted according to module depth order followed by alphabetical. This means that resources that are in your immediate configuration are listed first, and resources that are more deeply nested within modules are listed last.
For complex infrastructures, the state can contain thousands of resources. To filter these, provide one or more patterns to the command. Patterns are in resource addressing format.
The command-line flags are all optional. The following flags are available:
-state=path
- Path to the state file. Defaults to "terraform.tfstate". Legacy option for the local backend only.-id=id
- ID of resources to show. Ignored when unset.This example will list all resources, including modules:
$ terraform state list
aws_instance.foo
aws_instance.bar[0]
aws_instance.bar[1]
module.elb.aws_elb.main
This example will only list resources for the given name:
$ terraform state list aws_instance.bar
aws_instance.bar[0]
aws_instance.bar[1]
This example will list resources in the given module and any submodules:
$ terraform state list module.elb
module.elb.aws_elb.main
module.elb.module.secgroups.aws_security_group.sg
This example will only list the resource whose ID is specified on the command line. This is useful to find where in your configuration a specific resource is located.
$ terraform state list -id=sg-1234abcd
module.elb.aws_security_group.sg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4