5.2. Infrastructure as Code (IaC)
Infrastructure as Code treats system configuration as software — version-controlled, peer-reviewed, tested, and deployed consistently. The core value is idempotency: running the same IaC definition twice produces the same result, whether the system is brand new or already configured. This property is what makes IaC safe to run repeatedly — it converges to the desired state without causing damage if the state is already correct.
💡 First Principle: Imperative automation says "run these steps in this order." Declarative IaC says "here is the desired state — achieve it." The declarative approach is more robust: it doesn't matter what the current state is (provisioned, partially configured, already correct) — the tool handles convergence. Ansible is primarily declarative (desired state via modules); bash scripts are typically imperative.
⚠️ Common Misconception (M8): git push does not push all local branches by default — it pushes the current branch to its configured upstream. git push origin main pushes specifically the main branch to origin. git push --all pushes all branches. Many candidates assume git push syncs everything.