TF-004 Understand Terraform basics Practice Question
A team is new to Terraform and wants to manage their cloud infrastructure. They have written configuration files but have not yet run any commands. What is the correct sequence of initial steps to deploy their infrastructure?
⚠ Common exam trap
A common mistake is thinking that `terraform validate` or `terraform plan` can be run before `terraform init`, but in reality, `init` is mandatory first because it downloads providers and sets up the backend, without which no other command can execute.
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
✓
Run terraform init, then terraform plan, then terraform apply
The correct sequence is `terraform init`, `terraform plan`, then `terraform apply`. `terraform init` must be run first to initialize the working directory, download required provider plugins (e.g., AWS, Azure), and set up the backend state storage. Without initialization, subsequent commands like `plan` and `apply` will fail because Terraform cannot locate providers or configure the state backend. After initialization, `terraform plan` creates an execution plan showing what resources will be created, modified, or destroyed, and `terraform apply` executes that plan to deploy the infrastructure.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Run terraform init, then terraform plan, then terraform apply
Why this is correct
This sequence represents the standard and required workflow for managing infrastructure with Terraform. The `terraform init` command is essential for initializing the working directory, downloading necessary provider plugins and modules, and setting up the backend. Following this, `terraform plan` generates an execution plan, detailing all proposed infrastructure changes without making any modifications. Finally, `terraform apply` executes this plan, provisioning or modifying the infrastructure to match the desired state defined in the configuration.
- ✗
Run terraform plan, then terraform apply, then terraform init
Why it's wrong here
This order is incorrect because `terraform plan` and `terraform apply` both depend on a properly initialized working directory. The `terraform init` command is a mandatory first step responsible for downloading necessary provider plugins, modules, and configuring the backend for state management. Without this initial setup, Terraform cannot interpret the configuration or interact with the cloud provider APIs, leading to immediate errors when attempting to generate a plan or apply changes.
- ✗
Run terraform validate, then terraform plan, then terraform apply
Why it's wrong here
While `terraform validate` is a useful command for checking syntax and configuration consistency, it does not fulfill the critical role of `terraform init`. The `init` command is indispensable for downloading the required provider plugins and modules, which `terraform plan` and `terraform apply` rely upon to interact with the target infrastructure. Without `init`, subsequent commands will fail as the necessary components for execution are not present in the working directory, regardless of validation status.
- ✗
Run terraform apply, then terraform plan, then terraform init
Why it's wrong here
This sequence is fundamentally flawed as `terraform apply` attempts to provision resources without an initialized environment or a validated execution plan. The `terraform init` command must precede any operation that interacts with providers or modules, ensuring the necessary components are present. Furthermore, `terraform plan` is essential for reviewing the proposed changes before they are committed to the infrastructure. Attempting to apply changes first would result in immediate errors due to missing provider configurations and an unknown state.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
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.