Skip to content
EgyKode
04 · Infrastructure as CodeLab 20 / 59
Guided labterraform

Terraform Fundamentals

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

This lab adds

  • Resources created from code, and a state file that tracks them

Before you start

You will need

  • Terraform >= 1.6
  • AWS CLI v2, configured

You do not need these already — the lab environment below provides them.

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

CostLow cost

— one `t3.micro` and an S3 bucket. Nothing here runs an hourly-billed resource beyond the instance itself.

Nothing to pay in the browser. Open the terminal runs this against a simulated cloud — the same API calls and the same commands, with no account and no bill. The figure above applies only if you build it in your own.

How to clean up

The scenario#

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.

Open the terminal

Opens in Killercoda, in a new tab — keep this page open for the steps.

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.

The provider

Step 1 of 5

Clean up#

Run this even if you did not finish.

DestructiveThis removes real resources. Check which environment you are in first.

Terminal
terraform destroy -auto-approve
aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query 'Reservations[].Instances[].InstanceId'
aws s3 ls | grep tf-fundamentals   # must print nothing

Cost of this lab: Free tier — one t3.micro and an S3 bucket. Nothing here runs an hourly-billed resource beyond the instance itself.

Success criteria

0 of 5

The concept behind it

Ready to try it without help?Do the challenge

Next up

Lab 20 of 59 on the project path

Terraform ModulesTurn a working configuration into a network module and a compute module, called twice with different inputs.Why next: Resources created from code, and a state file that tracks them50 minIntermediate

Previous: RDS PostgreSQL: Backups, Restore and Failover