Viewing Resource Attributes in Terraform State

The show subcommand

The terraform state show command is used to show the attributes of a single resource in the Terraform state.


The show subcommand has the following syntax: terraform state show [options] ADDRESS.


The ADDRESS specified by the show subcommand must be an instance of a resource and not a grouping of resources created by count or for_each. The attributes of the resource are listed in alphabetical order and are sent to stdout for consumption by some type of parsing engine.

Use of the terraform state show command

The most common use for this command is to inspect the values stored in particular attributes. A secondary process could use the output to initiate the post-configuration of an instance or be fed into a configuration management database (CMDB).

How to apply Terraform state show command

Let’s say we want to view the properties of our aws_s3_bucket resource. We run the following command to see the attributes of the resource in the Terraform state:

Get hands-on with 1200+ tech skills courses.