Infrastructure as Code (IaC) with Terraform
Understand the core concepts, benefits, and patterns of Infrastructure as Code using Terraform.
Infrastructure as Code (IaC) is a methodology that allows you to manage and provision computing infrastructure through machine-readable configuration files rather than manual processes or interactive configuration tools. Terraform, developed by HashiCorp, is one of the leading IaC tools that enable…
Concepts covered: What is Infrastructure as Code, Declarative vs Imperative approaches, IaC configuration files and version control, Consistency and repeatability in infrastructure, Version control and collaboration benefits, Automation and reduced manual errors, Infrastructure documentation as code, Multi-cloud infrastructure management, Hybrid cloud deployment patterns, Provider-agnostic infrastructure workflows
TA-004 - Infrastructure as Code (IaC) with Terraform Example Questions
Test your knowledge of Infrastructure as Code (IaC) with Terraform
Question 1
Scenario: You are the lead infrastructure engineer at an e-commerce company. Your team recently migrated from a monolithic Terraform configuration to a modular structure with separate directories for networking, compute, and database resources. During a code review, you discover that developers have been copying and modifying shared module code into their local directories instead of referencing the centralized modules. This has created multiple versions of the same module logic scattered across the repository, making updates inconsistent and error-prone. Problem: Which version control and module management strategy should you implement to ensure consistent module usage across all team members?
Question 2
A small e-commerce startup wants to deploy their application using Terraform across both AWS and Google Cloud Platform. They plan to host their frontend on AWS CloudFront and their backend APIs on GCP Cloud Run. The team has written a single Terraform configuration file containing resources for both providers. During the first terraform apply, they receive authentication errors for GCP while AWS resources are created successfully. The team has confirmed that both cloud CLI tools work correctly from the command line. What is the most likely cause of this issue and how should they resolve it?
Question 3
Nexus Technologies operates a healthcare platform with strict HIPAA compliance requirements. Their infrastructure team of 10 engineers manages Terraform configurations for patient data systems. During a recent security audit, the auditor requested documentation showing every change made to the encryption module over the past year, including timestamps, authors, and the specific lines of code modified in each update. The team currently has all configurations in a Git repository but has been making changes through direct pushes to the main branch. The compliance manager needs to demonstrate granular traceability for regulatory purposes. Which version control practice would provide the most comprehensive audit trail for meeting these compliance documentation requirements?