Infrastructure Comparisons

Side-by-side trade-offs where neither column wins. The workload, the team and the operational budget decide — and each comparison ends with the verdict that follows from that, not from a preference.

Declarative vs imperative infrastructure

Desired state against a sequence of operations. Declarative wins for managing a fleet over time; it is not universally better.

DimensionDeclarativeImperative
You writeWhat should existWhat to do
Repeat runsConverge — safe to re-runRe-execute — often not idempotent
DriftDetectable by comparing to stateInvisible
ReviewA plan you can read before it happensYou read the script and hope
Ordering controlInferred from dependenciesExactly what you wrote
One-off operational taskAwkwardNatural
Learning costA tool, a language and a state modelA shell you already know
Use Declarative when
  • Infrastructure that lives for years and changes repeatedly.
  • Several people change it and changes must be reviewed.
  • You need environments to be reproducible.
Use Imperative when
  • A one-off migration or investigation.
  • An operational runbook step.
  • Bootstrapping before any state exists.
Verdict

Declarative for anything that persists, imperative for anything that happens once. The mistake is a shell script that provisions the fleet — and the opposite mistake is a module that wraps one resource in twenty variables.