Terraform Fundamentals Course / Chapter 1 — What Is IaC (lessons 1–4) / Lesson 1

What Is IaC: Writing the Desired State as Code

Time needed: about 4 min (estimate)

☆ Read later

You can try the opening of this lesson without an account.

What's wrong with doing this by hand

Create servers, networks, and databases one by one from a cloud console, and the same things always happen.

You can't rebuild an exact copy of production for testing.

Someone changes a setting from the console, and the runbook drifts from reality.

Nobody can review a change like "should this port be open?" before it happens.

A server you spun up to try something gets forgotten and left running, racking up charges.

IaC (Infrastructure as Code) is the practice of writing infrastructure's "desired state" into a text file, and letting a tool build that state.

Since it's code, you can keep a history in git, review it through pull requests, and build the exact same thing as many times as you like.

This course uses Terraform as that tool.

Write the "desired state," not the steps

In Terraform, you don't write "what steps to build it with" — you write "what you want the end result to be."

The first example isn't the cloud — it's a file on your own computer.

You write only the shape "hello.txt has this content," never the steps to create it.

Create a free account to keep reading

With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.

Report a problem with this lesson

Log in to send a report.

Keyboard shortcuts

Keys available in a lesson
KeyAction
[ or Alt + ←Go to the previous lesson
] or Alt + →Go to the next lesson
?Open this list
EscClose this list

The keys do not work while the cursor is in a code editor or an input field.