Defining infrastructure in files
Infrastructure as Code means describing your servers, networks, and cloud resources in text files instead of clicking through a console. Those files are stored in version control and applied by tooling to create or update real resources.
Declarative vs imperative
- Declarative you describe the desired end state and the tool figures out the steps. This is the most common style.
- Imperative you write the exact sequence of commands to run.
Declarative tools track a state of what exists and compute the difference, or plan, needed to reach the target.
Why it helps
- Repeatable spin up identical environments for dev, staging, and production.
- Reviewable changes go through code review and leave an audit trail.
- Versioned you can see history and roll back to a known good config.
- Less drift the files are the source of truth, reducing manual surprises.
A key practice is reviewing the plan before applying it, so you see exactly what will change.
Key idea
Infrastructure as Code captures resources in version controlled declarative files, making provisioning repeatable, reviewable, and auditable while reducing configuration drift.