INFRA-DEVOPS Contents

Declarative vs Imperative IaC

Choose declarative workflows for drift control; keep imperative actions for break-glass runbooks only.

On this page

Declarative vs Imperative (Ops Lens)

  • Declarative: define desired end state; tool reconciles.
  • Imperative: issue commands that mutate state now.
  • Prefer declarative for production to minimize drift and human variance.

When Imperative Is Acceptable

  • Break-glass incident actions (documented, time-bounded, followed by reconciliation).
  • One-off diagnostics that do not change durable infrastructure state.

Runbook: Break-Glass to Reconcile

  1. Declare incident and record who/why/when.
  2. Perform minimal imperative action to stabilize.
  3. Open a reconciliation PR to match reality back to IaC.
  4. Run drift detection and close loop.

Example

# Anti-pattern: manual changes become permanent
# Better: follow with IaC update and drift check

1) Stabilize (break-glass)
2) Reconcile (IaC PR)
3) Verify (drift is zero)