TF-004 Understand IaC concepts Practice Question
Which two commands are part of the standard Terraform workflow for provisioning infrastructure?
⚠ Common exam trap
HashiCorp often tests the distinction between provisioning commands and lifecycle or maintenance commands, so candidates may incorrectly select `terraform taint` or `terraform import` because they associate them with changing infrastructure, even though they do not directly provision new resources.
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 init
`terraform init` is correct because it initializes a working directory containing Terraform configuration files, downloading the required providers and modules. `terraform apply` is correct because it executes the actions proposed in a Terraform plan to provision or change infrastructure resources. These two commands form the core of the standard workflow: initialize, plan, and apply.
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 init
Why this is correct
The `terraform init` command is an indispensable first step in the standard Terraform workflow, executed whenever a new or existing configuration is started or updated. It performs crucial setup tasks, including downloading and installing the necessary provider plugins, initializing the configured backend for state management, and preparing any modules referenced in the configuration. Without successfully running `init`, Terraform cannot properly interact with the configuration files or the remote infrastructure providers.
- ✗
terraform fmt
Why it's wrong here
While `terraform fmt` is a valuable utility for maintaining consistent code style and readability across Terraform configurations, it is not considered part of the core provisioning and management workflow. Its sole purpose is to rewrite configuration files to a canonical format, ensuring uniformity and improving collaboration among team members. This command does not interact with the remote state, generate execution plans, or modify any infrastructure resources.
- ✓
terraform apply
Why this is correct
The `terraform apply` command is a central component of the standard Terraform workflow, responsible for executing the infrastructure changes proposed in a `terraform plan`. It interacts directly with the configured cloud providers or services to create, update, or delete resources, bringing the real-world infrastructure into alignment with the desired state defined in the configuration files. This command is the ultimate action that provisions or modifies infrastructure.
- ✗
terraform import
Why it's wrong here
The `terraform import` command serves a specialized function, allowing users to bring pre-existing infrastructure resources, which were not originally created by Terraform, under Terraform's management. While useful for migrating existing infrastructure into an Infrastructure as Code paradigm, it is an auxiliary operation rather not a routine step in the standard, iterative workflow of defining, planning, and applying new infrastructure changes. It facilitates onboarding existing resources rather than defining new ones.
- ✗
terraform taint
Why it's wrong here
The `terraform taint` command is an exceptional operation used to manually mark a specific resource in the Terraform state as "tainted," forcing its destruction and subsequent recreation on the next `terraform apply` operation. This command is typically employed for troubleshooting, recovering from a corrupted resource, or forcing a specific resource to be rebuilt even if its configuration hasn't changed. Consequently, it is a diagnostic or recovery tool, not a regular part of the standard infrastructure provisioning and management workflow.
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.