Automation
Idempotency
Cheat sheet · https://pcornel.dk/topic.php?topic=5995
Answer
Idempotency means running an automation once or many times gives the same end state, because it checks current state and only changes what differs. It makes reruns and retries safe.
Remember
- Check current state before every change.
- A second run should report no changes.
- Prefer set over append operations.
First checks
- Second run reports no changes — proof
terraform plan -detailed-exitcode— 0 after apply- Idempotency tests in CI (Molecule idempotence) — automation
Verify in this order
desired → compare → change only if needed
Where it usually breaks
Automation/controller success is not target-state proof; target config/state is not effective-runtime proof; effective state is not workload proof.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5995