Step 01 of 06
Understand the idea
Creating infrastructure by clicking through a console can be difficult to repeat or review later. Infrastructure as code describes resources in files, so you can review the changes, see who made them, and recreate the setup.
Key technical ideas
Describe the infrastructure you want
A runbook lists steps for a person to follow. With infrastructure as code, files describe what resources should exist. Terraform compares that description with the current infrastructure and proposes changes. A Terraform provider translates those changes into requests for a service such as AWS.
Repeat changes safely
An operation is idempotent when repeating it leaves the system in the same state. For example, running mkdir -p folder twice still creates one folder. Running echo line >> file twice adds the line twice. Infrastructure tools compare the desired resources with the current ones to avoid creating duplicates.
Make servers repeatable and replaceable
A server maintained by hand can collect changes that are not written down. If it fails, rebuilding the same setup is difficult. Treating servers as replaceable means keeping their configuration in files and creating a new server from those files when needed. The important thing is the repeatable setup, not one specific machine.
IaC makes change review concrete
A merge request can show that a database moved from private to public, a security group opened port 22 to the world, or a node size doubled. That diff is searchable later. It is also reviewable before money is spent. Console changes can be logged, but logs say what happened after the fact. A plan says what will happen while there is still time to stop it.
The tool cannot remove judgement
IaC can faithfully create a terrible design. It will not know that a CIDR is too small, that NAT costs are inappropriate, or that a secret slipped into state. Cloud APIs also return eventually consistent answers. Treat Terraform as a careful operator with a ledger, not as architecture in a box. You still own the blast radius.
mkdir -p deploy/infra
cat > deploy/infra/intent.txt <<'TXT'
beacon needs one private network, one small host, and a destroy plan.
TXT
cat deploy/infra/intent.txtThe example is deliberately plain. The value is not the text file; it is the habit of writing intent before touching infrastructure. Terraform gives that habit a provider protocol, a graph and a state file.
Manual change versus declared change
| Question | Console change | IaC change |
|---|---|---|
Who approved it? | Maybe a ticket | The merge request |
Can it repeat? | Only if remembered | Yes, from files |
Can it drift? | Silently | Plan can reveal it |
Failure mode | Snowflake server | Bad code, reviewed |
Audit trail | Provider logs | Git plus provider logs |
Technical terms used at work
Declarative — Describes the desired end state, not the step-by-step procedure used to reach it.
Drift — A difference between configuration, Terraform state and the real resource now returned by the provider API.
Snowflake — A unique server or environment that cannot be recreated because its important changes were manual.
Reconciliation — The loop that compares desired and observed state, then acts to reduce the difference.
