TF-004 Use Terraform outside the core workflow Practice Question
A company uses Terraform with a backend configured to store state in Azure Blob Storage. They want to view the current state of resources without performing a plan or apply. Which command should be used?
⚠ Common exam trap
HashiCorp often tests the distinction between commands that inspect state directly (like terraform state list) versus those that trigger a refresh or plan (like terraform plan or terraform show with a state file), and candidates mistakenly choose terraform show thinking it lists resources, but it actually displays detailed attributes and requires a state file argument.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
terraform state list
(terraform state list) is correct because it directly queries the Terraform state file stored in Azure Blob Storage and lists all resources tracked in that state without triggering a plan or apply. This command is part of the 'terraform state' family, designed specifically for inspecting state outside the core workflow, and it requires no infrastructure changes or API calls to cloud providers.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
terraform output
Why it's wrong here
The `terraform output` command is designed to display the values of output variables explicitly defined within your Terraform configuration. It does not provide a comprehensive list of all resources managed by the state file. Instead, it only shows the specific data points that have been deliberately exposed for consumption by other configurations or users, making it unsuitable for inventorying every tracked resource.
- ✗
terraform show
Why it's wrong here
The `terraform show` command provides a detailed, human-readable representation of the current state or a plan file. When executed without a plan file, it displays the entire content of the state file, including all resource attributes and their values. While it contains information about all resources, its output is verbose and structured for inspection of resource details, not for generating a concise list of resource addresses.
- ✓
terraform state list
Why this is correct
The `terraform state list` command is the correct tool for this purpose as it is specifically designed to enumerate all resource addresses currently tracked within the Terraform state file. It queries the backend and returns a clean, line-by-line list of every managed resource, such as `aws_instance.web` or `null_resource.example`. This command provides a direct and efficient way to see all infrastructure components that Terraform is managing.
- ✗
terraform plan
Why it's wrong here
The `terraform plan` command is used to preview the changes that Terraform will make to your infrastructure to match your configuration. It compares the desired state (from your configuration) with the current state (from the state file and real-world infrastructure) and proposes a set of actions. This command focuses on the *delta* or future operations, rather than providing a static inventory of all resources already managed by the state file.
Quick reference
Azure Blob Storage Tier Comparison
| Tier | Storage Cost | Retrieval Cost | Latency | Use Case |
|---|---|---|---|---|
| Hot | Highest | Lowest | Immediate | Active data, frequent reads |
| Cool | Lower | Higher | Immediate | Data accessed < once / month |
| Cold | Lower still | Higher | Immediate | Data accessed < once / quarter |
| Archive | Lowest | Highest + rehydration delay | Hours | Long-term compliance retention |
Go deeper
Related to this question
About these practice questions
Courseiva writes every TF-004 question from scratch — 428 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This TF-004 practice question is part of Courseiva's free HashiCorp certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the TF-004 exam.