HashiCorp Terraform Associate (004) Question 15
Single answer1b Describe the advantages of IaC patternsA platform team manages development, staging, and production environments in a cloud provider. Historically, engineers created resources manually in the console, which led to inconsistent naming, missing tags, and differences in network settings between environments. The team wants to standardize deployments with Terraform and reduce environment drift while making reviews easier during change requests. Which Terraform-based approach best demonstrates the advantages of Infrastructure as Code (IaC) patterns for this scenario?
- A
Create reusable Terraform modules for shared components such as networking and compute, and use variables to supply environment-specific values for dev, staging, and prod.
- B
Export the current cloud resources into spreadsheets for each environment and require engineers to compare them manually before making future changes.
- C
Keep separate hand-written Terraform files for each environment with duplicated resource blocks so each team can customize them independently.
- D
Continue creating infrastructure in the cloud console, but document the final settings in a wiki so future environments can be rebuilt more consistently.
Show answer and explanation
Correct answer: A
Explanation
The best answer is to use reusable Terraform modules with variables for environment-specific inputs. One of the key advantages of IaC patterns is consistency through codification: the same validated configuration can be reused across environments, reducing manual differences and drift. Terraform also supports change review through version control and plan output, which helps teams evaluate proposed infrastructure updates before applying them. HashiCorp best practices emphasize using modules to organize and reuse configuration, and using variables to parameterize deployments instead of duplicating code. In this scenario, those patterns directly solve inconsistent naming, missing tags, and network differences while improving maintainability and reviewability.
- A. Correct.
Correct. Reusable modules plus input variables are a core IaC pattern in Terraform. This approach improves consistency, reduces duplication, and makes infrastructure changes reviewable as code. By defining common building blocks once and reusing them across environments, the team can enforce standard naming, tags, and configuration while still allowing controlled differences through variables. This directly addresses the scenario's goals of reducing drift and improving change reviews.
- B. Incorrect.
Incorrect. Spreadsheets do not provide declarative infrastructure management, execution plans, or automated reconciliation of desired state. Manual comparison is error-prone and does not solve the underlying inconsistency problem. A candidate might choose this because inventory tracking feels organized, but it lacks the repeatability and automation advantages of IaC.
- C. Incorrect.
Incorrect. Although Terraform is being used, duplicating resource definitions across separate files is not a strong IaC pattern. It increases maintenance effort, raises the risk of configuration drift between environments, and makes standardization harder over time. This is a common misconception: using Terraform alone is not enough if the code structure encourages inconsistency.
- D. Incorrect.
Incorrect. Documentation can help operations, but it does not provide the main benefits of IaC such as version-controlled definitions, reusable patterns, automated planning, and consistent provisioning. Manual console changes remain difficult to audit and reproduce. Someone might choose this because documentation improves knowledge sharing, but it does not replace declarative infrastructure workflows.