A developer needs to inspect the current state of a specific resource managed by Terraform without modifying any infrastructure. Which command should they use?
The `terraform state show` command displays the attributes of a single resource in the state file. It is read-only and does not modify infrastructure or state. This allows the developer to inspect details such as IDs, IP addresses, and tags for the specified resource, fulfilling the requirement to view current state without changes.
Why this answer
The `terraform state show` command is designed to display the attributes of a single resource in the state file. It is read-only and does not alter infrastructure or state. Other commands like `refresh` modify state, `plan` shows planned changes, and `output` displays only defined outputs.
Therefore, `state show` is the correct choice for inspecting a specific resource without modifications.
Exam trap
The trap here is confusing `terraform state show` with `terraform show`, which displays the entire state or a plan file, not a single resource.