HashiCorp Terraform Associate (004) Question 11
Single answer1b Describe the advantages of IaC patternsA company manages three environments for the same web application: development, staging, and production. Today, engineers create each environment manually in the cloud console, and small differences between environments often cause failed releases and difficult troubleshooting. The team wants to adopt Terraform using reusable modules and version-controlled configuration files. Which advantage of this Infrastructure as Code (IaC) pattern best addresses their current problem?
- A
It enables consistent, repeatable environment provisioning from the same reviewed configuration.
- B
It removes the need to run plan before apply because modules automatically prevent drift.
- C
It allows Terraform to update every environment without storing state, reducing configuration errors.
- D
It guarantees that all production changes are safe because version control replaces testing.
Show answer and explanation
Correct answer: A
Explanation
This scenario focuses on a core advantage of IaC patterns: using shared, reusable code to create consistent infrastructure across environments. In Terraform, teams commonly use modules to encapsulate standard infrastructure patterns and store configurations in version control for collaboration, code review, and traceability. Together, these practices reduce manual configuration differences and make infrastructure deployments repeatable. HashiCorp documentation and Terraform best practices emphasize declarative configuration, reusable modules, and plan/apply workflows as key mechanisms for improving consistency and reducing drift compared with manual provisioning. However, Terraform still requires state management, and version control does not replace testing or change review.
- A. Correct.
Correct. One of the primary advantages of IaC patterns such as reusable modules and version-controlled Terraform configuration is consistency and repeatability. Defining infrastructure in code lets teams provision development, staging, and production from the same logical definitions, reducing configuration drift and environment-specific mistakes that commonly occur with manual console changes.
- B. Incorrect.
Incorrect. Terraform modules help standardize infrastructure definitions, but they do not remove the need for terraform plan. Plan is still a core workflow step used to preview changes before applying them. Modules also do not automatically prevent drift; Terraform detects drift by comparing configuration and state to real infrastructure.
- C. Incorrect.
Incorrect. Terraform relies on state to map resources in configuration to real-world infrastructure. Avoiding state is not how Terraform reduces errors. In fact, properly managed state is essential to safe and predictable operations. The misconception here is confusing declarative configuration with stateless execution.
- D. Incorrect.
Incorrect. Version control is a major IaC advantage because it provides change history, collaboration, and peer review, but it does not guarantee that changes are safe. Testing, validation, planning, and approval processes are still necessary. This option overstates what version control alone can provide.