Infrastructure as code (Terraform and Ansible)
In short: Infrastructure as code describes servers, networks and services in files that are versioned like program code and executed automatically.
In more detail: Terraform creates infrastructure (servers, databases, DNS) at cloud providers and keeps it at the described state. Ansible configures machines (installing packages, copying files, starting services) over SSH, agentless.
In Depth
- Declarative vs. imperative: Terraform describes the goal, a script describes the steps.
- Idempotence: Running it several times changes nothing if everything is already correct.
- Advantages: repeatable, traceable in Git, less manual work, fast recovery.
- State: Terraform remembers what it created. This file is sensitive.
- Secrets: Passwords do not belong in code but in a vault (keeping API keys safe).
See also: Kubernetes, CI/CD pipeline