Why Terraform? What it really does in production
Why Terraform?
What it really does in production.
From clicks, to code, to the real thing.
Words you'll meet
Building by hand
Signed in to the production account. Nothing has been built yet.
| Name | VPC ID | State | IPv4 CIDR |
|---|---|---|---|
| shop-vpc | vpc-0f3c9a1b2d4e5f607 | Available | 10.0.0.0/16 |
| Name | Instance ID | State | Type | Zone | Status checks |
|---|---|---|---|---|---|
| web-1 | i-0a1b2c3d4e5f60718 | Running | t3.small | eu-west-2a | checks passed |
| web-2 | i-09f8e7d6c5b4a3921 | Running | t3.small | eu-west-2b | checks passed |
| DB identifier | Status | Engine | Class |
|---|---|---|---|
| shop-db | Available | PostgreSQL | db.t3.micro |
Illustration: the fields match what AWS shows; the layout is simplified. Not a real screenshot.
It works. So what's the problem?
What goes wrong with clicking
Clicking works once. The problems show up over months.
Describe it in a file
resource "aws_vpc" "shop" {
cidr_block = "10.0.0.0/16"
}
resource "aws_instance" "web" {
count = 2
instance_type = "t3.small"
}
resource "aws_db_instance" "shop" {
engine = "postgres"
instance_class = "db.t3.micro"
}
Plan: see it before it happens
!p $ terraform plan !m Terraform will perform the following actions: !g # aws_vpc.shop will be created !g # aws_instance.web[0] will be created !g # aws_instance.web[1] will be created !g # aws_db_instance.shop will be created !p Plan: 4 to add, 0 to change, 0 to destroy.
Apply: what really happens
Waiting for apply…
| Name | Instance ID | State | Type | Zone | Status checks |
|---|---|---|---|---|---|
| web-1 | i-0a1b2c3d4e5f60718 | Running | t3.small | eu-west-2a | checks passed |
| web-2 | i-09f8e7d6c5b4a3921 | Running | t3.small | eu-west-2b | checks passed |
Illustration: the fields match what AWS shows; the layout is simplified. Not a real screenshot.
Why teams rely on it
When Terraform isn't the answer
Servers come and go. Data stays.
The customer data is untouched.
High availability isn't backup
High availability keeps you running. Backups let you go back.
One common production split
Recap
- Clicking works once, but leaves no record, no whole-picture preview, and no easy rebuild.
- Terraform: describe it in a file, plan, then apply through the cloud's API.
- The result is the same real infrastructure, plus a reviewed record.
- Terraform builds the infrastructure. Other tools handle images, setup, releases and data.
Lesson map
Chapters
Hands-on reasoning
Practice lab
Build it for real: your first resourceoptional · about 5 min
Your first real Terraform run: write a file, plan, apply, look at state, change something, and clean up. terraform_data, which is built in, stands in for a real resource, so you need no cloud account and it costs nothing.
You need: Terraform 1.4 or newer (install guide) or OpenTofu (install guide), and a terminal.
1. Make a folder with one file, main.tf
resource "terraform_data" "hello" {
input = "my first resource"
}
output "message" {
value = terraform_data.hello.output
}
2. Set up, then preview
terraform init
terraform plan
This is the real plan output from our test run, in full:
# terraform_data.hello will be created
+ resource "terraform_data" "hello" {
+ id = (known after apply)
+ input = "my first resource"
+ output = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
Notice (known after apply): the ID doesn't exist until the resource is really created.
3. Make it real, and see what state remembers
terraform apply
terraform state list
Type yes. You'll see message = "my first resource", and state lists terraform_data.hello.
4. Change your mind
Edit the input to "my changed resource", then:
terraform plan
# terraform_data.hello will be updated in-place and Plan: 0 to add, 1 to change, 0 to destroy. Terraform works out the difference between your file and what exists.
5. Clean up
terraform destroy
Type yes: Destroy complete! Resources: 1 destroyed.
Outputs above are real, captured with OpenTofu 1.12.6 on 3 October 2026, where the header line says "OpenTofu will perform the following actions" instead of "Terraform will…". Not run with the Terraform program itself, whose download is blocked in our test environment.
How to use this lesson
Glossary. Tap any dotted-underlined term for a plain-English explanation. Playback pauses while you read.
Keyboard. Space or K plays/pauses, left and right arrows change chapter, and 1–4 answer a quick check.
Narration. The lesson currently uses your device's speech engine. The content is already segmented so recorded or cloned voice clips can replace it later without redesigning the lesson.