Chapter 12: Infrastructure as Code and Configuration Management
Word target: 3,600
Primary deliverable: Git-managed infra and config workflows
Key diagrams: GitOps reconciliation loop
Learning Goals
- Separate provisioning from configuration responsibilities.
- Build idempotent, reviewable automation.
- Detect and remediate configuration drift.
MVP Lab Worksheet
- Objective: Provision one Ubuntu node from code.
- Starting state: Manual workflows in place.
- Steps:
- Create repo structure for IaC + config.
- Provision target node via declarative workflow.
- Run idempotency check.
- Evidence: Pipeline/apply logs.
- Exit criteria: Repeatable no-drift apply.
- Rollback: Reapply previous stable commit.
Advanced Lab Worksheet
- Objective: Drift detection pipeline.
- Starting state: IaC baseline active.
- Steps:
- Introduce controlled drift.
- Detect via automated checks.
- Reconcile and document incident.
- Evidence: Drift alert + reconciliation evidence.
- Exit criteria: Drift closed without manual snowflake edits.
- Rollback: Freeze automation and restore from stable tag.
Portability Placeholder
Ensure provider-specific modules are isolated behind common interfaces.