TF-004 Understand IaC concepts Practice Question
A Terraform user wants to visualize the execution order of resources before applying changes. Which command provides a dependency graph view?
⚠ Common exam trap
HashiCorp often tests the distinction between commands that show execution plans (`terraform plan`) versus those that visualize the underlying dependency graph (`terraform graph`), leading candidates to mistakenly choose `terraform plan` for graph visualization.
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 graph
The `terraform graph` command generates a visual representation of the dependency graph for Terraform resources, showing the execution order based on implicit and explicit dependencies. This allows users to see which resources will be created, updated, or destroyed in sequence before applying changes. It outputs DOT format, which can be rendered with tools like Graphviz.
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 graph
Why this is correct
The `terraform graph` command is specifically designed to generate a visual representation of the dependency graph for a Terraform configuration. It processes the configuration files and outputs a graph in the DOT format, which can then be rendered into an image using external tools like Graphviz. This visual output clearly illustrates the relationships and execution order between resources, modules, and providers, making it the ideal tool for visualizing the infrastructure's provisioning flow.
- ✗
terraform show
Why it's wrong here
The `terraform show` command serves to display the current state of a Terraform workspace or the detailed contents of a saved plan file. It provides a textual representation of managed resources, their attributes, and their current values, offering a snapshot of the infrastructure's deployed state or planned changes. However, it does not generate any graphical output or visualize the intricate dependencies between resources, focusing solely on data inspection.
- ✗
terraform plan
Why it's wrong here
The `terraform plan` command is used to preview the actions Terraform will take to achieve the desired state defined in the configuration. It calculates and presents a textual summary of proposed changes, including resource additions, modifications, and destructions, implicitly considering dependencies to determine the operational sequence. While it informs the user about *what* will happen, it does not produce a visual diagram of the underlying dependency graph itself, which is crucial for understanding execution order visually.
- ✗
terraform output
Why it's wrong here
The `terraform output` command's sole purpose is to display the values of output variables defined within a Terraform configuration. These outputs are typically used to extract and present important information, such as endpoint URLs or resource IDs, after infrastructure provisioning is complete. This command provides no functionality for analyzing or visualizing the inter-resource dependencies or the execution order of operations within the Terraform graph.
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.