INFRA-DEVOPS Contents

Infrastructure as Code Principles

Run IaC like production code: repeatable plans, safe apply, review gates, and clear rollback paths.

On this page

Operational Principles

  • Everything is reviewed: no direct apply from laptops in production.
  • Plan is evidence: store plan outputs and approvals for audit.
  • Idempotency: re-running should converge, not surprise.

Golden Workflow

  1. Format + validate
  2. Plan (read-only) and publish plan summary
  3. Policy checks (OPA / Sentinel / custom)
  4. Approval gate
  5. Apply using the same commit + same inputs

Command Skeleton (Tool-Agnostic)

# Validate locally or in CI
iac fmt
iac validate

# Create a plan artifact (read-only preview)
iac plan --out plan.bin

# Apply exactly the planned change
iac apply plan.bin

Failure Modes

  • Applying without a saved plan: you cannot prove what changed.
  • Changing variables between plan/apply: plan becomes meaningless.