HashiCorp Terraform Associate (004) Question 14
Single answer1b Describe the advantages of IaC patternsA platform team manages separate development, staging, and production environments in AWS. Today, each environment was created manually, and engineers frequently discover differences in security group rules, instance sizes, and tagging. The team wants to standardize deployments with Terraform while making reviews easier and reducing configuration drift between environments. Which approach best demonstrates the advantages of Infrastructure as Code (IaC) patterns in this scenario?
- A
Create reusable Terraform modules for shared infrastructure patterns and use environment-specific input variables so each environment is provisioned from version-controlled code.
- B
Export the current cloud configuration from each environment once, save the output in text files, and use those files as the long-term source of truth for future changes.
- C
Allow each team to keep manually configuring its own environment, but require engineers to document every infrastructure change in a wiki after deployment.
- D
Use Terraform only for production so that development and staging can remain flexible and be updated manually when needed.
Show answer and explanation
Correct answer: A
Explanation
This scenario focuses on the practical advantages of IaC patterns: standardization, repeatability, reusability, reviewability, and reduced drift. In Terraform, these benefits are commonly achieved by defining infrastructure declaratively in code, storing it in version control, and reusing modules with different input variables for each environment. This pattern allows teams to apply the same tested infrastructure design across development, staging, and production while preserving controlled differences. HashiCorp documentation and Terraform best practices emphasize reusable modules, plan-and-apply workflows, and version-controlled configuration as key ways to manage infrastructure safely and consistently. Compared with manual processes or static exports, Terraform configurations provide an executable source of truth that can be reviewed, shared, and reused.
- A. Correct.
Correct. Reusable modules plus environment-specific variables are a core IaC pattern in Terraform. This approach promotes consistency, reuse, reviewability, and repeatability across environments while still allowing intentional differences through inputs. Storing the configuration in version control also improves collaboration, change tracking, and auditability. Using the same code patterns across environments helps reduce configuration drift and makes infrastructure changes easier to validate with commands such as terraform plan before applying them.
- B. Incorrect.
Incorrect. Exporting configuration snapshots to text files does not provide the key IaC benefits of declarative, executable, version-controlled infrastructure definitions. Text exports are static records, not maintainable provisioning logic. They do not support consistent redeployment, parameterization, code review, or automated change workflows in the way Terraform configuration does.
- C. Incorrect.
Incorrect. Documentation can help teams understand changes, but it does not enforce consistency or prevent drift. Manual provisioning remains error-prone and difficult to reproduce. A common misconception is that good documentation alone can substitute for IaC; in practice, IaC reduces reliance on manual steps by making the desired state executable.
- D. Incorrect.
Incorrect. Using Terraform for only one environment weakens one of the major advantages of IaC patterns: consistent deployment across environments. If development and staging are still managed manually, differences will continue to appear and production changes will be less reliably tested in matching pre-production environments.