TF-004 Use Terraform outside the core workflow Practice Question
Exhibit
Initializing modules... Downloading registry.terraform.io/hashicorp/consul/aws 0.1.0... - consul in modules/consul
Refer to the exhibit. Which command was most likely executed?
⚠ Common exam trap
The exam often tests the distinction between `terraform init` (which handles provider and backend setup) and `terraform get` (which only handles modules), leading candidates to confuse module downloading with provider initialization.
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
The exhibit shows Terraform downloading and installing provider plugins (e.g., hashicorp/aws) and initializing the backend configuration. This is the exact behavior of `terraform init`, which prepares the working directory for other commands by ensuring all required providers and modules are available.
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 apply
Why it's wrong here
terraform apply is used to execute the actions proposed in a Terraform plan, provisioning or modifying real infrastructure resources. This command assumes that the Terraform working directory has already been fully initialized, meaning all necessary provider plugins are downloaded, the backend is configured, and all referenced modules have been retrieved. It does not perform any module downloading operations itself; if modules are missing, apply would fail, indicating an uninitialized state.
- ✗
terraform plan
Why it's wrong here
terraform plan generates an execution plan, detailing the changes Terraform will make to infrastructure to match the desired state defined in the configuration files. This command strictly requires a fully initialized working directory, meaning all external modules must have been downloaded and the backend configured prior to its execution. It evaluates the current configuration against the current state, but it does not perform any preparatory steps like downloading modules or configuring providers.
- ✗
terraform get
Why it's wrong here
terraform get is a specialized command focused solely on downloading and updating modules referenced in the current Terraform configuration. While it successfully retrieves modules, its output is typically concise and pertains exclusively to the module fetching process, without displaying the comprehensive "Initializing modules" message that encompasses other setup tasks. It does not handle backend configuration or provider plugin downloads, which are broader initialization responsibilities.
- ✓
terraform init
Why this is correct
terraform init is the foundational command responsible for preparing a Terraform working directory for use. It performs several critical setup tasks, including discovering and downloading necessary provider plugins, configuring the backend for state storage, and recursively downloading all modules referenced in the configuration. The command's output explicitly includes messages like "Initializing modules," "Initializing provider plugins," and "Initializing the backend," directly matching the exhibit's likely "Initializing modules" output.
Go deeper
Related to this question
About these practice questions
One of 428 original TF-004 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.