- A
Use a separate Git branch for each environment, each with its own Terraform configuration.
Why wrong: Branch-per-environment can lead to drift and merge conflicts.
- B
Write a single Terraform configuration that uses count and conditional expressions to create resources based on environment variable.
Why wrong: This leads to a monolithic configuration that is hard to read and test.
- C
Use Terraform workspaces with a single configuration and define all variable values in one .tfvars file.
Why wrong: One .tfvars file cannot hold multiple environment-specific values easily.
- D
Organize the repository with a shared modules directory and separate subdirectories for each environment that call the same modules with environment-specific .tfvars files.
This structure maximizes reuse and keeps environment-specific variables separate.
Quick Answer
The correct approach is to organize the repository with a shared modules directory and separate subdirectories for each environment that call the same modules with environment-specific .tfvars files. This pattern minimizes code duplication by centralizing reusable infrastructure logic inside Terraform modules, while each environment’s root configuration simply references those modules and passes unique variable values through separate .tfvars files. On the HashiCorp Terraform Associate TF-003 exam, this question tests your understanding of Terraform multi-environment modules and the recommended directory structure—a common trap is choosing workspaces or conditional logic, which can introduce state corruption or complexity. Remember the memory tip: “One module, many .tfvars” — keep your module code dry, and let each environment’s folder hold only its own variable overrides.
TF-003 Understand IaC concepts Practice Question
This TF-003 practice question tests your understanding of understand iac concepts. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
An organization manages multiple environments (dev, staging, prod) using Terraform. They want to minimize code duplication while allowing environment-specific variable values. Which approach best achieves this goal?
Clue words in this question
Noticing these words before you look at the options changes how you read each choice.
Clue:
"best"Why it matters: Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.
Clue:
"minimum / minimize"Why it matters: Asks for the least resource use — fewest addresses, smallest subnet, lowest overhead. Eliminate over-provisioned options even if they would technically work.
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
Organize the repository with a shared modules directory and separate subdirectories for each environment that call the same modules with environment-specific .tfvars files.
Option D is correct because it leverages Terraform's module system to define reusable infrastructure components in a shared directory, while each environment (dev, staging, prod) has its own subdirectory with a root configuration that calls those modules and passes environment-specific `.tfvars` files. This minimizes code duplication by keeping the module logic in one place, and allows per-environment variable values without mixing concerns. It follows the recommended pattern for multi-environment management in Terraform, avoiding the pitfalls of branches, workspaces, or conditional logic that can lead to complexity or state corruption.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use a separate Git branch for each environment, each with its own Terraform configuration.
Why it's wrong here
Branch-per-environment can lead to drift and merge conflicts.
- ✗
Write a single Terraform configuration that uses count and conditional expressions to create resources based on environment variable.
Why it's wrong here
This leads to a monolithic configuration that is hard to read and test.
- ✗
Use Terraform workspaces with a single configuration and define all variable values in one .tfvars file.
Why it's wrong here
One .tfvars file cannot hold multiple environment-specific values easily.
- ✓
Organize the repository with a shared modules directory and separate subdirectories for each environment that call the same modules with environment-specific .tfvars files.
Why this is correct
This structure maximizes reuse and keeps environment-specific variables separate.
Clue confirmation
The clue words "best", "minimum / minimize" in the question point toward this answer.
Related concept
Read the scenario before looking for a memorised answer.
Common exam traps
Common exam trap: answer the scenario, not the keyword
HashiCorp often tests the misconception that Terraform workspaces are the correct way to manage multiple long-lived environments, but workspaces are actually designed for short-lived or temporary infrastructure, not for permanent dev/staging/prod separation, because they share the same backend configuration and can lead to accidental state corruption if not carefully isolated.
Detailed technical explanation
How to think about this question
Under the hood, Terraform modules are called with `source` pointing to a local or remote path, and each environment's root module can pin a specific version of the module (e.g., via Git tags) to ensure consistent deployments. A real-world scenario is an organization using a private module registry to version shared infrastructure (like VPCs or EKS clusters), where each environment's `.tfvars` file overrides only the necessary variables (e.g., `instance_type = "t3.micro"` for dev vs `"m5.large"` for prod), while the module itself handles all resource definitions. This approach also enables separate state files per environment (e.g., `dev.tfstate`, `prod.tfstate`) when using different backend configurations, which is critical for isolation and blast radius reduction.
KKey Concepts to Remember
- Read the scenario before looking for a memorised answer.
- Find the constraint that changes the correct option.
- Eliminate answers that are true in general but not in this case.
TExam Day Tips
- Watch for words such as best, first, most likely and least administrative effort.
- Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
- →
Understand IaC concepts — study guide chapter
Learn the concepts, then practise the questions
- →
Understand IaC concepts practice questions
Targeted practice on this topic area only
- →
All TF-003 questions
519 questions across all exam domains
- →
HashiCorp Terraform Associate TF-003 study guide
Full concept coverage aligned to exam objectives
- →
TF-003 practice test guide
How to use practice tests most effectively before exam day
Related practice questions
Related TF-003 practice-question pages
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
Understand IaC concepts practice questions
Practise TF-003 questions linked to Understand IaC concepts.
Understand Terraform basics practice questions
Practise TF-003 questions linked to Understand Terraform basics.
Understand Terraform's purpose practice questions
Practise TF-003 questions linked to Understand Terraform's purpose.
Use Terraform outside the core workflow practice questions
Practise TF-003 questions linked to Use Terraform outside the core workflow.
Interact with Terraform modules practice questions
Practise TF-003 questions linked to Interact with Terraform modules.
Use the core Terraform workflow practice questions
Practise TF-003 questions linked to Use the core Terraform workflow.
Implement and maintain state practice questions
Practise TF-003 questions linked to Implement and maintain state.
Read, generate and modify configuration practice questions
Practise TF-003 questions linked to Read, generate and modify configuration.
TF-003 fundamentals practice questions
Practise TF-003 questions linked to TF-003 fundamentals.
TF-003 scenario practice questions
Practise TF-003 questions linked to TF-003 scenario.
TF-003 troubleshooting practice questions
Practise TF-003 questions linked to TF-003 troubleshooting.
Practice this exam
Start a free TF-003 practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this TF-003 question test?
Understand IaC concepts — This question tests Understand IaC concepts — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Organize the repository with a shared modules directory and separate subdirectories for each environment that call the same modules with environment-specific .tfvars files. — Option D is correct because it leverages Terraform's module system to define reusable infrastructure components in a shared directory, while each environment (dev, staging, prod) has its own subdirectory with a root configuration that calls those modules and passes environment-specific `.tfvars` files. This minimizes code duplication by keeping the module logic in one place, and allows per-environment variable values without mixing concerns. It follows the recommended pattern for multi-environment management in Terraform, avoiding the pitfalls of branches, workspaces, or conditional logic that can lead to complexity or state corruption.
What should I do if I get this TF-003 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Are there clue words in this question I should notice?
Yes — watch for: "best", "minimum / minimize". Signals that multiple options may be partially correct. Choose the option that most directly solves the exact problem described, not the one that sounds most complete.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 30, 2026
This TF-003 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-003 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.