github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/cli/commands/state/show.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Command: state show" 4 sidebar_current: "docs-commands-state-sub-show" 5 description: |- 6 The `terraform state show` command is used to show the attributes of a single resource in the Terraform state. 7 --- 8 9 # Command: state show 10 11 The `terraform state show` command is used to show the attributes of a 12 single resource in the 13 [Terraform state](/docs/language/state/index.html). 14 15 ## Usage 16 17 Usage: `terraform state show [options] ADDRESS` 18 19 The command will show the attributes of a single resource in the 20 state file that matches the given address. 21 22 This command requires an address that points to a single resource in the 23 state. Addresses are 24 in [resource addressing format](/docs/cli/state/resource-addressing.html). 25 26 The command-line flags are all optional. The list of available flags are: 27 28 * `-state=path` - Path to the state file. Defaults to "terraform.tfstate". 29 Ignored when [remote state](/docs/language/state/remote.html) is used. 30 31 The output of `terraform state show` is intended for human consumption, not 32 programmatic consumption. To extract state data for use in other software, use 33 [`terraform show -json`](/docs/cli/commands/show.html#json-output) and decode the result 34 using the documented structure. 35 36 ## Example: Show a Resource 37 38 The example below shows a `packet_device` resource named `worker`: 39 40 ``` 41 $ terraform state show 'packet_device.worker' 42 # packet_device.worker: 43 resource "packet_device" "worker" { 44 billing_cycle = "hourly" 45 created = "2015-12-17T00:06:56Z" 46 facility = "ewr1" 47 hostname = "prod-xyz01" 48 id = "6015bg2b-b8c4-4925-aad2-f0671d5d3b13" 49 locked = false 50 } 51 ``` 52 53 ## Example: Show a Module Resource 54 55 The example below shows a `packet_device` resource named `worker` inside a module named `foo`: 56 57 ```shell 58 $ terraform state show 'module.foo.packet_device.worker' 59 ``` 60 61 ## Example: Show a Resource configured with count 62 63 The example below shows the first instance of a `packet_device` resource named `worker` configured with 64 [`count`](/docs/language/meta-arguments/count.html): 65 66 ```shell 67 $ terraform state show 'packet_device.worker[0]' 68 ``` 69 70 ## Example: Show a Resource configured with for_each 71 72 The example below shows the `"example"` instance of a `packet_device` resource named `worker` configured with 73 [`for_each`](/docs/language/meta-arguments/for_each.html): 74 75 Linux, Mac OS, and UNIX: 76 77 ```shell 78 $ terraform state show 'packet_device.worker["example"]' 79 ``` 80 81 PowerShell: 82 83 ```shell 84 $ terraform state show 'packet_device.worker[\"example\"]' 85 ``` 86 87 Windows `cmd.exe`: 88 89 ```shell 90 $ terraform state show packet_device.worker[\"example\"] 91 ```