Idempotency
Cheat sheet · https://pcornel.dk/topic.php?topic=5153
Answer
Idempotency means repeated application of the same desired request converges on the same intended state without accumulating unintended side effects.
Remember
- Idempotent ≠ no-op on every rerun; a rerun may correctly repair drift.
- Idempotency ≠ determinism; timestamps, generated IDs or API metadata may differ while the managed state still converges.
- Idempotent module ≠ idempotent workflow; ordering and external side effects can break end-to-end idempotency.
- Create-if-missing ≠ safe retry automatically; partial failure and duplicate-request semantics must be understood.
First checks
ansible-playbook site.yml --check --diff— changes only when neededterraform plan -detailed-exitcode— exit 0 = no changes- Second run reports no changes — idempotency proof
Verify in this order
desired state → compare current → change only differences
Where it usually breaks
An idempotent task proves convergence for its defined managed state; it does not guarantee the surrounding workflow or external side effects are idempotent.
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Idempotency automation boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Intent / inputs | Owner, scope and authoritative inputs are explicit and versioned where applicable | Hidden defaults, stale inventory or competing sources of truth |
| Decision / execution | Plan or decision is explainable and actions are bounded per target | Blind fan-out, implicit assumptions or success based only on executor status |
| State / verification | Target is re-observed and acceptance criteria prove the intended outcome | No read-back, perpetual drift, partial side effects or unresolved exceptions |
| Recovery / evidence | Retry, rollback or escalation behavior is defined and auditable | Unknown partial completion, unsafe retry or evidence lost during remediation |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5153