Problem Statement
What is Infrastructure as Code (IaC) in CD context?
Explanation
Infrastructure as Code (IaC) defines and manages infrastructure using code files instead of manual processes. Infrastructure configurations stored in version control, reviewed through pull requests, deployed via automation. Tools: Terraform (cloud-agnostic), CloudFormation (AWS), ARM templates (Azure), Pulumi (multi-language).
Benefits: version control (track changes, rollback), consistency (identical environments), automation (no manual steps), reproducibility (recreate infrastructure easily), documentation (code is documentation). IaC in CD: infrastructure changes go through same CI/CD pipeline as application code - test, review, deploy.
Approach: declarative (define desired state, tool ensures state) vs imperative (define steps to reach state). Best practices: modularize infrastructure code, test infrastructure changes, use variables for environment differences, implement state management, separate infrastructure and application deployments. Understanding IaC enables reliable, repeatable infrastructure deployments.
