You are tasked with managing AWS infrastructure using Terraform. Your team needs to create multiple identical VPCs across different regions. Which approach would be most efficient?
- Use terraform apply multiple times with hardcoded values
- Create separate configuration files for each VPC
- Manually provision each VPC using the AWS console
- Use a Terraform module to define VPC configuration and call it multiple times with different variables ✓
Correct answer: Use a Terraform module to define VPC configuration and call it multiple times with different variables
Option D is correct because Terraform modules allow you to encapsulate a reusable VPC configuration once and invoke it multiple times with different input variables (such as region and CIDR block), which is the idiomatic Infrastructure-as-Code approach and drastically reduces duplication and maintenance burden. Option A is incorrect because running terraform apply multiple times with hardcoded values produces brittle, non-reusable configurations and makes drift management very difficult. Option B is incorrect because creating separate configuration files for each VPC violates the DRY principle and multiplies the amount of code that must be maintained and kept in sync. Option C is incorrect because manually provisioning resources through the AWS console bypasses Terraform entirely, eliminating version control, auditability, and automation benefits.
Topic: · terraform modules, infrastructure as code, reusability, aws vpc