Terraform Fundamentals — Challenge
Provider, resource, variable, output, state — the five pieces, on infrastructure small enough to read in one screen.
- Time
- 45 min
- Level
- Beginner
- Objectives
- 5 objectives
- Cost
- Low cost
Where this fits in the platform
Already built
This lab adds
- Resources created from code, and a state file that tracks them
Which lets you
Before you start
You will need
- Terraform >= 1.6
- AWS CLI v2, configured
You will be able to
- Declare a provider and pin its version
- Read a plan and name what each symbol means
- Move a hardcoded value into a variable and out through an output
- Explain what the state file is and why it is not disposable
Cost — Low cost
— one `t3.micro` and an S3 bucket. Nothing here runs an hourly-billed resource beyond the instance itself.
The goal#
Achieve the same outcome as Terraform Fundamentals, from an empty starting point, without the steps.
Before a VPC module makes any sense, the five pieces underneath it have to be concrete: what a provider is, what a resource declaration produces, where a value comes in, where a value goes out, and what Terraform remembers between runs.
This lab builds the smallest infrastructure that exercises all five.
Hands-on environment
Run this lab in a real terminal, free and in your browser. The environment is temporary and yours alone — break it as much as you like.
Start the challengeOpens in Killercoda, in a new tab — keep this page open for the steps.
This is the guided lab's environment — the same machine, with its walkthrough on the left. Work from the task above and leave those steps alone until you are done, or you are reading the answers.
Run it on AWS
This lab builds real cloud infrastructure, so it needs your own AWS account. Follow the cost and cleanup notes above — the resources are yours, and so is the bill.
Anything you tick here is your own record. EgyKode cannot see inside that terminal, so the success criteria stay self-assessed even when the environment checks your work for you.
What must be true when you are done
Step 1 of 3
What must be true when you are done#
terraform applycreates an EC2 instance and an S3 bucket from a single configuration.- Running
terraform applya second time reportsNo changes— you can explain why. - The instance type comes from a variable, and the public IP leaves through an output.
- You can point at the line in
terraform.tfstatethat maps your resource to its real AWS id. terraform destroyremoves everything, verified with the AWS CLI.
Rules#
- Do not open the guided lab until you are finished, or until the same problem has held you up for 20 minutes.
- Documentation is allowed. In the job it is the first thing you open.
- Verify every criterion with a command whose output you can read.
If you get stuck#
- What did you expect, exactly?
- What happened instead — the error text, not a paraphrase?
- Which layer is that error from?
- What is the smallest command that proves the layer below is fine?
You are done when
0 of 5
The concept behind it
Next up
Lab 20 of 59 on the project path