iac.htora.dev · security templates

Home/Refreshers/Infrastructure as code: refresher

Infrastructure as code

Writing down the infrastructure you want in files, and letting a tool make reality match them.

Remember

  1. Terraform creates things in a cloud account. Ansible sets up the inside of machines. Argo CD keeps a Kubernetes cluster matching Git.
  2. Declarative: you describe the end result, and the tool works out the steps.
  3. Idempotent: running it twice is safe. The second run changes nothing.
  4. The files live in Git, so every change has an author, a review, and a way back.

Preview, apply, undo

Preview with Terraformterraform plan
Preview with Ansibleansible-playbook -i inventory.ini site.yml --check --diff
Preview with Argo CDargocd app diff <app>
Undo any of themgit revert <commit>, then apply or sync again

Watch out

  • A change made by hand in a console is drift. The next run either undoes it or trips over it.
  • Secrets end up in files and in state. Keep them out of Git.
  • A preview too long to read gets skipped. Keep each change small.
Check it worked

Run the same thing twice. The second run reports no changes.

Read the full pageDownload PDF

Registry 0.23.0. Built 2026-11-17.

Made by Habibullah Tora. Source on GitHub. Code under the MIT licence, writing under CC BY 4.0.