TF-004 Use the core Terraform workflow Practice Question
Which three of the following are required steps in the core Terraform workflow for managing infrastructure? (Choose three.)
⚠ Common exam trap
HashiCorp often tests the distinction between mandatory workflow steps and optional auxiliary commands, so the trap here is that candidates confuse helpful but non-essential commands like `terraform fmt` or `terraform validate` with the core required steps of write, init, and plan.
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
✓
Write Terraform configuration files that define the desired state of resources.
The core Terraform workflow consists of three essential steps: writing configuration files to define the desired state, running `terraform init` to initialize the working directory and download provider plugins, and running `terraform plan` to review the execution plan before applying changes. These steps form the fundamental 'write, plan, apply' cycle that Terraform uses to manage infrastructure declaratively. Without these, you cannot safely or correctly provision resources.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Write Terraform configuration files that define the desired state of resources.
Why this is correct
This is the foundational step where users define their desired infrastructure using HashiCorp Configuration Language (HCL) in `.tf` files. These files declare resources, data sources, variables, and outputs, specifying the target end state of the infrastructure rather than a sequence of commands. This declarative approach allows Terraform to determine the necessary actions to achieve that specified state during subsequent steps.
- ✓
Run terraform init to initialize the working directory and download provider plugins.
Why this is correct
The `terraform init` command is mandatory for preparing a new or existing Terraform configuration directory for use. It performs several crucial setup tasks, including discovering and downloading required provider plugins, initializing backend configurations for state storage, and downloading any necessary modules. Without `init`, subsequent commands like `plan` or `apply` cannot function as they lack the necessary components and context.
- ✓
Run terraform plan to review the execution plan before applying changes.
Why this is correct
The `terraform plan` command is a critical safety and review step in the core workflow. It analyzes the current infrastructure state, compares it with the desired state defined in configuration files, and generates an execution plan detailing exactly what actions Terraform will take (create, update, or destroy resources). This allows users to inspect and confirm all proposed changes before they are actually applied to the infrastructure.
- ✗
Run terraform destroy to remove all managed resources after every apply.
Why it's wrong here
`terraform destroy` is used to tear down all resources managed by a specific Terraform configuration, but it is not a required step *after every apply*. The core workflow aims to maintain and evolve infrastructure over time, not to immediately destroy it after creation or modification. Destroy is typically reserved for decommissioning environments, cleaning up temporary resources, or specific development scenarios.
- ✗
Run terraform fmt to automatically fix formatting issues in configuration files.
Why it's wrong here
`terraform fmt` is a utility command that automatically rewrites Terraform configuration files to a canonical format, improving readability and consistency across a codebase. While highly recommended for maintaining code quality and team collaboration, it is an optional step and not a *required* part of the core workflow for Terraform to function correctly. The `plan` and `apply` commands will execute regardless of formatting.
- ✗
Run terraform validate to check configuration syntax before initializing the backend.
Why it's wrong here
`terraform validate` checks the configuration files for syntax errors and internal consistency, ensuring they are syntactically valid and semantically coherent. However, it typically requires an initialized backend and downloaded providers to fully validate, especially for provider-specific schema checks. Therefore, it is not a required step *before* initializing the backend; `terraform init` usually precedes or is part of the validation process for comprehensive checks.
Go deeper
Related to this question
About these practice questions
This TF-004 question is part of Courseiva's 428-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.