What Is Terraform? Make an S3 Bucket by Hand, Then From Code
What you’ll learn
- Meet Larkvale Retail, the fictional company we run for the whole course
- Know what Terraform is – infrastructure described in files
- Make the same S3 bucket by hand and from code, and compare the two
- Delete both, and know why Terraform only deletes what it made
What you need
- An AWS account (we use our personal course account, Region us-east-1)
- Nothing to install yet – lesson 002 sets up the tools. Just watch this one.
Meet Larkvale Retail
For the whole course, you work for Larkvale Retail. It's a made-up company, created for this course. You've just joined its DevOps team. Larkvale has two departments, Sales and People, with four applications. By the end of the course, one central pipeline builds and deploys all of them, with Terraform.
What Terraform is
Terraform is infrastructure as code. You describe what you want in text files, and Terraform makes AWS match them. To see why that matters, we'll make the same thing twice. An S3 bucket, once by hand, and once from code. An empty bucket costs nothing, so this lesson is free.
A bucket by hand
First, the bucket by hand, so you can see every choice the console makes for you. In S3, open General purpose buckets, and choose Create bucket.

Name it larkvale lab 001 hand, plus today's date. Bucket names are shared by every AWS account in the world, so yours must be different.

Now look at the defaults. Block all public access is on. That's a safe choice, but nothing records that we made it.

Default encryption, with S3 managed keys, is on too. Choose Create bucket.

There it is. A few clicks, and it works. But nobody can review what we picked before we picked it, and nobody can repeat it exactly.

The same bucket from code
Next, the same bucket from code.
We work in a terminal. You'll install these tools in the next lesson, so for now, just watch. First, cd (change directory), moves us into the lesson folder. Terraform always works on the files in the folder you're in.
cd terraform/001-first-bucket
We need a file called main.tf, where we write what we want Terraform to build. touch creates the empty file (on Windows, run the commands in Git Bash, which comes with Git – lesson 002). It appears in the Explorer on the left.
touch main.tf
Now we type into main.tf. First, the terraform block. It says which provider we need. A provider is the plugin that talks to one platform. Here, the AWS provider, from HashiCorp, version 6.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 6.0"
}
}
}
provider "aws" {
region = "us-east-1"
}
resource "aws_s3_bucket" "from_code" {
bucket_prefix = "larkvale-lab-001-code-"
tags = {
Company = "Larkvale Retail"
Lesson = "001"
}
}
output "bucket_name" {
value = aws_s3_bucket.from_code.bucket
}
Then the provider block. It says where to build. Region us-east-1.
A resource block is one thing Terraform builds. Its type, aws S3 bucket, and our own label for it, from code. Inside, bucket prefix is the start of the name. Terraform adds a unique ending, so the name never clashes. And a tags block, so anyone can see it belongs to Larkvale, and to this lesson.
Last, an output prints a value when Terraform is done. Here, the bucket's real name. That's the whole file.

Let Terraform build it
terraform init gets the folder ready. It downloads the AWS provider, the plugin Terraform uses to talk to AWS. Keep an eye on the Explorer. init adds two new items to our folder.
terraform init
Here they are. The .terraform folder holds the downloaded provider. And the lock file records its exact version, so everyone on the team gets the same one.

terraform plan shows what Terraform would do, without changing anything.
terraform plan
The plus means create. One to add, our bucket. Nothing has changed in AWS yet.

terraform apply makes the change.
terraform apply
It shows the plan again, and asks if we want to go ahead. Only yes is accepted, so we type yes. Watch the Explorer again. apply writes one more file.
Apply complete. One added. And at the end, our output, the bucket's full name. In the Explorer, a new file appeared, terraform.tfstate. It's Terraform's record of what it built. Module 3 is all about it.

Back in S3, General purpose buckets.
Two buckets now. The one we made by hand, and the one from code, with the unique ending Terraform added.

They look the same. The difference is how they got there. The code is a file. It's reviewed before it runs, every change is kept in Git, and running it again makes the same bucket anywhere. Deleting it is one command. That's the whole idea of this course.
Delete both
Now we delete both buckets, so nothing is left behind.
Terraform first. terraform destroy deletes everything this code created, and nothing else.
terraform destroy
It asks first, so we type yes.
Destroy complete. One destroyed. Terraform never knew about the hand-made bucket, so it's still there.

That one we delete by hand.
In General purpose buckets, select it, and choose Delete.

Type the bucket's name to confirm, and choose Delete bucket.

Both buckets are gone. Nothing from this lesson is left in the account.

Summary
- Terraform is infrastructure as code – you describe what you want in .tf files, Terraform makes AWS match
- Code can be reviewed, kept in Git and repeated exactly; console clicks can't
- init downloads the provider, plan shows what would change, apply makes the change, destroy removes it
- Terraform only manages what it created; the hand-made bucket was never touched
- Cost of this lesson: free (two empty S3 buckets for a few minutes)
What’s next
Next lesson, you set up your own workstation. Terraform, the AWS CLI, Git and VS Code, signed in safely, with no access keys.