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:
    1. Create repo structure for IaC + config.
    2. Provision target node via declarative workflow.
    3. 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:
    1. Introduce controlled drift.
    2. Detect via automated checks.
    3. 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.