Every level, in the open
Cloud & IaC
7 worlds · 76 levels · 7 bosses
SOLUTION HIDDENTeachers see answer keys in the classroom.
Run a cloud account from the terminal: IAM, VPCs, compute, storage, then Terraform-style IaC, security posture and cost. Honest note: cloud, tf and tofu are SIMs of the AWS CLI, Terraform and OpenTofu that print the real command; one lab world runs real OpenTofu.
Guided levels show the command first. Alone levels give the goal only. Bosses and exams are timed.
Jump to a world
World 1Sky Console
12 levelsYour first cloud account: who you are, where things live, and what you're allowed to do.
Level 1: Who am I up there?
Objective: Find the account ID your terminal is signed in to and tell Kern with kern ACCOUNT_ID.
Every cloud command is an API call signed by an identity. hidden (real: aws sts get-caller-identity) answers: which account, which user.
Commands taught
cloudcloud-identityLevel 2: Pick a city
Objective: Give your terminal a home region, Paris, then tell Kern the zone ID of eu-west-3b.
A region is a city full of datacenters (eu-west-3 = Paris); an Availability Zone (AZ) is one separate building in it, like eu-west-3b. hidden (real: aws configure set region eu-west-3) writes the default into ~/.cloud/config (real: ~/.aws/config).
Commands taught
regions-azscloud-configureLevel 3: Needle in the fleet
Objective: Twelve servers run in Paris; tell Kern the instance ID of the one tagged Team=payments and Env=prod.
--filters Name=tag:Team,Values=payments makes the API return only matches, and --query 'Reservations[].Instances[].InstanceId' --output text (same flags in aws) keeps just the field you want.
Commands taught
query-outputLevel 4: A badge for Noor
Objective: Noor joins as an auditor: give her a user in a group auditors that has the managed policy ReadOnlyAccess.
IAM (Identity and Access Management) users are people or programs; a group hands the same policies to all its members. Give permissions to groups, not users: cloud iam create-group = aws iam create-group.
Commands taught
iam-users-groupsLevel 5: Only the reports
Objective: Lena may download sky-reports/reports/* and nothing else: write that policy, attach it to lena, and prove it.
A policy is JSON: Effect (Allow/Deny), Action (s3:GetObject) and Resource (an ARN, * allowed at the end: arn:aws:s3:::sky-reports/reports/*). Least privilege: allow exactly what the job needs, nothing more.
Commands taught
iam-policy-jsonpolicy-simulatorLevel 6: Name tags for everything
Objective: Label annex: first copy Kern's example, then add a second label on your own.
A tag is a Key=Value label you stick on any resource: cloud ec2 create-tags --resources ID --tags Key=Owner,Value=noor (real: aws ec2 create-tags). Filters and bills can then find it.
Commands taught
tagsLevel 7: The server that vanished
Objective: Mira swears her server night-owl exists but nobody sees it: find it and tag it Owner=mira.
Resources are regional: describe-instances only looks in your default region. --region ap-southeast-1 (same in aws) sends one command to another region; tags (Key=Owner,Value=mira) label anything.
Commands taught
tagsLevel 8: Who can burn the vault?
Objective: Three users have S3 rights; tell Kern which one can delete the bucket sky-vault (kern NAME).
The policy engine: an explicit Deny anywhere wins, then any Allow, else implicit deny. simulate-principal-policy answers for one user without trying the real thing.
Commands taught
policy-evaluationLevel 9: Spare keys
Objective: Practice the key moves on the throwaway user temp-bot, so the pager level feels familiar.
An access key is an ID plus a secret. A user can hold two: that is how you rotate. update-access-key flips one Active/Inactive, create-access-key makes a new one, and a profile in ~/.cloud/config stores the settings for one identity.
Commands taught
access-keys-profilesLevel 10: PAGER: key on GitHub
Objective: PAGER: ci-bot's key leaked: kill it, make a new key, and set up profile ci (region eu-west-3) so hidden works.
An access key (ID + secret) is a password for programs: if it leaks, deactivate it, make a new one, and give it to the program. Profiles in ~/.cloud/credentials (real: ~/.aws/credentials) hold several keys; --profile ci or AWS_PROFILE=ci picks one.
Commands taught
access-keys-profilesLevel 11: Taking a badge back
Objective: Find who holds a policy, then take it back from one user.
To see who holds a managed policy: cloud iam list-entities-for-policy --policy-arn P. To take it from a user: cloud iam detach-user-policy --user-name U --policy-arn P. The policy itself survives; only the link is cut.
Commands taught
least-privilegeLevel 12: The intern with the crown
Objective: Least-privilege audit: the intern pip has admin; leave pip with read+write on sky-logs/intern/* only, and prove it.
Find who holds AdministratorAccess, take it from the intern, give the intern a group with a scoped policy, then prove it by simulation.
Commands taught
least-privilegeiam-roles
World 2Sky Harbor
13 levelsBuild the harbor's private network (VPC, subnets in two zones, gates, guards on every door) and find out why the lights go dark.
Level 13: A harbor in the sky
Objective: Create the harbor's VPC: CIDR 10.40.0.0/16, tagged Name=harbor (see ~/harbor/ticket.txt).
A VPC is your own private network inside the cloud, defined by one CIDR block. cloud ec2 create-vpc (real: aws ec2 create-vpc) makes it; --tag-specifications gives it a Name so humans can find it.
Commands taught
vpcLevel 14: Two docks, two buildings
Objective: Create subnets dock-a (10.40.1.0/24 in eu-west-3a) and dock-b (10.40.2.0/24 in eu-west-3b) in the harbor VPC.
A subnet is a slice of the VPC's block that lives in ONE availability zone. It must fit inside the VPC, must not overlap another subnet, and the cloud keeps 5 of its addresses (network, router, DNS, reserved, broadcast).
Commands taught
subnet-cidrLevel 15: Open the harbor gate
Objective: Make dock-a public: attach an internet gateway to harbor and route 0.0.0.0/0 to it from a route table associated with dock-a.
An internet gateway is the VPC's door to the internet. A subnet is PUBLIC only when its route table sends 0.0.0.0/0 to that gateway; subnets without that route are private.
Commands taught
internet-gatewayroute-tableLevel 16: Guards on the lighthouse
Objective: Make the lighthouse reachable on HTTPS from anywhere, with SSH allowed only from the admin laptop 198.51.100.7.
A security group is a stateful firewall on each server: only allow rules, and replies to allowed traffic go back automatically. cloud ec2 analyze-path (a SIM of the VPC Reachability Analyzer) traces a connection hop by hop and names the hop that blocks it.
Commands taught
analyze-pathsecurity-groupLevel 17: Block the noisy range
Objective: Deny all traffic from 192.0.2.0/24 into harbor's subnets with a network ACL rule that wins over the default allow (rule 100).
A network ACL guards a whole subnet with numbered allow AND deny rules, checked from the lowest number up; the first match wins. It is stateless: it doesn't remember connections.
Commands taught
network-aclLevel 18: NAT parts, one at a time
Objective: Handle every NAT piece once, in a toy VPC called yard, before the real job.
A NAT gateway is built from pieces: an Elastic IP, the gateway in a public subnet, and a route in the private table that points at it. Practise each piece in a small yard first.
Commands taught
nat-gatewayLevel 19: A quiet way out
Objective: Let ledger (private subnet hold-a) reach the internet on tcp 443 through a NAT gateway, without making it public.
A NAT gateway lets servers in a private subnet start connections to the internet while nobody can start one to them. It needs an Elastic IP, must live in a PUBLIC subnet, and the private subnet's route table sends 0.0.0.0/0 to it.
Commands taught
nat-gatewayLevel 20: Open and close doors
Objective: In the lane VPC: look at the route tables, close a door you opened by mistake, then let only the app tier in.
Security group rules can be removed (revoke-security-group-ingress, same flags as authorize) and can name another group as the source (--source-group sg-ID) instead of an IP range. describe-route-tables shows where each subnet's traffic goes.
Commands taught
security-groupLevel 21: Only the lighthouse may ask
Objective: Make ledger's API (tcp 8080) answer only servers in lighthouse-sg, not drifter and not the rest of the VPC.
A security group rule can name another security group as its source instead of an IP range: every server in that group is allowed, whatever its IP, now and later.
Level 22: The ferry went dark
Objective: Bring https://beacon (VPC ferry) back on tcp 443 from the internet without making anything else public.
When a server is unreachable, trace before you touch: analyze-path names the first blocked hop. Fix that hop, trace again, repeat.
Level 23: Four berths, five minutes
Objective: Carve 10.40.36.0/22 into 4 equal subnets in the harbor VPC, spread over eu-west-3a and eu-west-3b.
Splitting a block into 2^n equal pieces adds n bits to the prefix: a /22 makes four /24s. Spread them over zones so one zone failing can't take every berth.
Level 24: A name, a rule, a way out
Objective: Make a new security group, then give a locked-down subnet a way for its HTTPS answers to leave.
Create a security group with cloud ec2 create-security-group --vpc-id V --group-name G --description TEXT. A network ACL is stateless, so replies need their own OUTBOUND rule: create-network-acl-entry --egress --port-range From=1024,To=65535 (answers go to high ports).
Commands taught
security-groupnetwork-aclLevel 25: The Bazaar ticket
Objective: Work ticket BAZAAR-1 (~/harbor/ticket.txt): fix the old stall, then build the two-tier bazaar network.
A real two-tier network: a public web tier, a private app tier behind NAT, and security groups that chain web → app. Plus a reminder that ACLs are stateless.
Commands taught
sg-vs-nacl
World 3Fleet & Vault
11 levelsThe network is built, so fill it: servers, a storage vault, a load balancer, a name people can type, and a bill that makes sense.
Level 26: Light the first server
Objective: Launch web-1 from the nginx image as a t3.micro in subnet public-a with security group web-sg, as ~/fleet/ticket.txt asks.
An instance is a rented computer: an image (AMI = the disk it boots from), a type (its size and price), a subnet (where it lives) and security groups (who may talk to it). cloud ec2 run-instances = aws ec2 run-instances.
Commands taught
fleet-run-instancesLevel 27: Bigger boots for web-1
Objective: web-1 is out of memory: make it a t3.small and have it running again.
You can't change an instance's type while it runs: stop it, change the type (cloud ec2 modify-instance-attribute = aws ec2 modify-instance-attribute), start it. A stopped instance has no compute charge, but its disk (EBS volume) still bills.
Commands taught
fleet-instance-lifecycleLevel 28: A vault for the website
Objective: Make a bucket with a unique name and put ~/fleet/site/index.html at its top level.
S3 stores files (objects) in buckets. Bucket names are global: one namespace for every account on Earth, so 'assets' is long gone. cloud s3 mb / cp / ls = aws s3 mb / cp / ls.
Commands taught
fleet-s3-basicsLevel 29: Two servers, one front door
Objective: Put web-a and web-b behind a new load balancer web-alb until both targets report healthy.
An Application Load Balancer spreads requests over a target group of servers, across at least 2 AZs, and only sends traffic to targets that pass health checks. cloud elbv2 = aws elbv2.
Commands taught
fleet-load-balancerLevel 30: A name people can type
Objective: Create the zone fleet.example and point www.fleet.example at web-alb with an alias A record.
Route 53 is AWS's DNS. A hosted zone holds a domain's records; an alias A record points a name at an AWS resource like a load balancer and follows its changing IPs. cloud route53 = aws route53.
Commands taught
fleet-route53-aliasLevel 31: Is my bucket open?
Objective: In the small bucket lab-notes: test as a stranger, close the leak, and turn on versioning.
cloud s3api (real: aws s3api) is the low-level S3 API: get-bucket-policy reads who is allowed in, delete-bucket-policy removes it, put-public-access-block flips the four safety switches, put-bucket-versioning keeps old versions. --no-sign-request tests as a stranger.
Commands taught
fleet-bucket-privacyLevel 32: The invoices are public
Objective: The scanner says fleet-invoices-210987654321 is public: lock it down and keep old versions of every invoice.
Three locks keep a bucket private: the public access block (four switches that override everything), a bucket policy with no Principal "*", and versioning so a bad write or delete can be undone. --no-sign-request asks as a stranger.
Commands taught
fleet-bucket-privacyLevel 33: Zero healthy targets
Objective: Bring both targets of web-tg back to healthy, without opening the servers to the internet.
describe-target-health says WHY a target is out: Target.Timeout (a security group or NACL drops the check), Target.FailedHealthChecks (nothing answers on that port), Target.InvalidState (the instance isn't running).
Level 34: The bill, line by line
Objective: Read a bill, then remove one forgotten volume, one idle address and one forgotten server in another region.
cloud ce get-cost-and-usage (Cost Explorer) answers where the money goes: --time-period, --granularity, --metrics, then --group-by SERVICE or REGION. Waste is removed with delete-volume, release-address and terminate-instances, always one named ID at a time.
Commands taught
fleet-cost-explorerLevel 35: Who doubled the bill?
Objective: Remove the idle waste (an unattached volume, an unused Elastic IP, a forgotten server) without touching anything tagged env=prod.
cloud ce get-cost-and-usage (= aws ce get-cost-and-usage) splits the bill by SERVICE or REGION. SIM: it projects a month of what exists right now; real Cost Explorer reports what you were charged.
Commands taught
fleet-cost-explorerLevel 36: Ship the shop
Objective: Ship shop.fleet.example: two healthy servers behind shop-alb, as ~/fleet/ship/ticket.txt asks.
Everything at once: two servers in two AZs, a target group, a load balancer behind its own security group, healthy targets, and a DNS name. ~/fleet/ship/ticket.txt has the order.
World 4Blueprint Forge
13 levelsStop clicking, start writing: the same VPCs, subnets and buckets, now as code that plans, applies, remembers and heals.
Level 37: The first blueprint
Objective: Build the VPC described in ~/forge/vpc/main.tf with tf, reading the plan before you apply it.
A .tf file describes what should exist; tf init installs the provider, tf plan shows the diff, tf apply makes it real. SIM: tf = terraform, cloud_vpc = aws_vpc.
Commands taught
tftf-inittf-plantf-applyLevel 38: Wire it with references
Objective: Put the subnet in ~/forge/net inside the VPC by replacing the placeholder with a reference, then apply both.
A reference like cloud_vpc.main.id reads another resource's attribute, even one that doesn't exist yet. It also tells tf the order: the VPC first, then the subnet.
Commands taught
hcl-referencesLevel 39: Knobs and readouts
Objective: Set env to dev in ~/forge/vars with a terraform.tfvars file, apply, and hand Kern the VPC ID from tf output.
variable blocks are the blueprint's knobs (var.env); terraform.tfvars or -var env=dev sets them. output blocks print values after apply; tf output -raw NAME prints one bare.
Commands taught
tf-variables-outputsLevel 40: The forge remembers
Objective: Use the state of ~/forge/state to tell Kern how many resources tf tracks, then the real ID behind cloud_subnet.app.
terraform.tfstate maps each address (cloud_subnet.app) to a real ID (subnet-…). hidden shows the addresses, tf state show ADDR one resource. Never edit the file by hand.
Commands taught
tf-stateLevel 41: Stamp it twice
Objective: Add a module "prod" in ~/forge/modules/main.tf that stamps out the network as prod-net with 10.20.0.0/16, and apply it next to dev.
A module is a folder of .tf files you call like a function: module "prod" { source = "./modules/network" … }. After adding a module block, run tf init again.
Commands taught
tf-modulesLevel 42: The haunted port
Objective: Someone opened SSH to the world on the shop-web security group by hand: find the drift in ~/forge/drift and heal it from code.
Drift: someone changed the cloud by hand, so reality no longer matches code and state. tf plan refreshes, reports "changed outside of Terraform", and tf apply puts the code back.
Commands taught
tf-driftLevel 43: Adopt a hand-made bucket
Objective: Two hand-made buckets already have resource blocks in main.tf: adopt one with Kern's example, then the other alone.
tf import ADDRESS REAL_ID writes an existing cloud object into the state under the name of a resource block you already wrote. Terraform then manages it; tf plan should say there is nothing to change.
Commands taught
tf-importLevel 44: Adopt the stray bucket
Objective: Bring the hand-made bucket forge-artifacts-210987 under Terraform in ~/forge/import as cloud_s3_bucket.artifacts, with a clean plan.
tf import ADDR ID writes an existing object into the state under ADDR; you write its resource block yourself. Done when tf plan shows no changes. (Terraform 1.5+ also has an import {} block.)
Commands taught
tf-importLevel 45: One blueprint, many stages
Objective: Practise workspaces and var files on a toy blueprint with staging and qa stages.
A workspace is a separate state for the same code. hidden, new and select manage them, and tf apply -var-file stage.tfvars feeds one set of variables, so each stage gets its own copy.
Commands taught
tf-workspacesLevel 46: PAGE: prod by morning
Objective: Dev already runs from ~/forge/envs: create a prod workspace and build prod from prod.tfvars without touching dev.
A workspace is a separate state for the same code: hidden, then tf apply -var-file prod.tfvars builds a second copy that dev's state never sees.
Commands taught
tf-workspacesLevel 47: PAGE: burn the sandbox
Objective: Cost alarm: destroy the whole sandbox stack in ~/forge/stacks/sandbox before the bill closes, and keep the data stack alive.
tf destroy removes everything in ONE state: the folder you run it in. lifecycle { prevent_destroy = true } makes tf refuse any plan that would delete that resource.
Commands taught
tf-destroyLevel 48: Plan, save, apply exactly
Objective: The toy stack has drifted: detect it, save the fix as a plan file, apply exactly that file, and prove it is clean.
hidden exits 0 when nothing changes and 2 when something would, so scripts can detect drift. tf plan -out=FILE saves exactly what you reviewed, and tf apply FILE applies only that.
Commands taught
tf-saved-plansLevel 49: BOSS: Drift storm
Objective: Heal ~/forge/storm after a night of console clicking: detect the drift, save the fix as fix.plan, apply exactly that plan, and prove the plan is clean.
Code says what should exist, state what tf built, the cloud what is really there. plan -detailed-exitcode reports drift as exit code 2; a saved plan (-out) applies exactly what you reviewed.
Commands taught
tf-saved-plans
World 5Night Watch
12 levelsThe night shift: audit the account like a pro, chase a culprit in CloudTrail, cut the bill, close real tickets, survive the posture review.
Level 50: Public bucket hunt
Objective: Find the public bucket, block it, then switch on Block Public Access for the whole account.
cloud s3api get-bucket-policy-status (real: aws s3api get-bucket-policy-status) says if a bucket's policy makes it public. Block Public Access closes it: per bucket (s3api put-public-access-block) and for the whole account (s3control put-public-access-block).
Commands taught
posture-checklists3-block-public-accessLevel 51: Doors open to the world
Objective: Close 22 and 3389 to 0.0.0.0/0 in every group and allow them from the bastion 198.51.100.10/32 instead.
An audit query: --query 'SecurityGroups[?IpPermissions[?IpRanges[?CidrIp==`0.0.0.0/0`]]].GroupName' lists every group with a rule open to the internet (same JMESPath in real aws ec2 describe-security-groups). SSH (22) and RDP (3389) must only come from the bastion.
Commands taught
sg-auditLevel 52: Stale keys, missing MFA
Objective: Read the credential report, name the console user without MFA, and deactivate the access key nobody used for 90+ days.
The credential report (real: aws iam generate-credential-report / get-credential-report) is one CSV of every user: password, MFA, key age, key last use. Content comes base64-encoded, so pipe it through base64 -d.
Commands taught
credential-reportbase64Level 53: Read the black box
Objective: Search the trail of a small account: find an event type, trim the answer, then name the culprit of another.
CloudTrail records every API call: who, what, when, from where. cloud cloudtrail lookup-events (real: aws cloudtrail lookup-events) searches it: --lookup-attributes AttributeKey=EventName,AttributeValue=DeleteBucket picks an event type; --query and --output trim the answer.
Commands taught
cloudtrail-lookupLevel 54: Who opened port 22?
Objective: Find who opened SSH to the world on app-sg last night, close it, and deactivate that user's key.
CloudTrail logs every API call: who, what, when, from where. cloud cloudtrail lookup-events (real: aws cloudtrail lookup-events) searches it, e.g. --lookup-attributes AttributeKey=EventName,AttributeValue=AuthorizeSecurityGroupIngress.
Commands taught
cloudtrail-lookupLevel 55: Two bill tools
Objective: Practise the two bill commands of the next shift as dry runs: group the cost by team tag, then resize a stopped server.
Two moves for the cost shift: cloud ce get-cost-and-usage --group-by Type=TAG,Key=team splits the bill per team tag (real: aws ce get-cost-and-usage), and cloud ec2 modify-instance-attribute --instance-type resizes a stopped server (real: aws ec2 modify-instance-attribute).
Level 56: The idle giant
Objective: Tag the untagged instance with its team, find the most expensive team, and right-size batch-01 to m5.large.
Cost allocation tags (team=…) let Cost Explorer split the bill: cloud ce get-cost-and-usage --group-by Type=TAG,Key=team (real: aws ce get-cost-and-usage). Right-sizing an instance = stop, modify-instance-attribute --instance-type, start.
Commands taught
cost-tags-rightsizingLevel 57: TICKET-1042
Objective: Ship TICKET-1042 with tf from ~/watch/infra: private, versioned logs bucket, ci-deployer may only PutObject into it, plan clean.
A real ticket mixes everything: S3 privacy, versioning, least-privilege IAM, Terraform. cloud_s3_bucket_versioning = aws_s3_bucket_versioning; review the draft, fix it in code, tf apply, and prove it with a clean tf plan.
Commands taught
s3-versioning-tfLevel 58: Is the site answering?
Objective: Test a DNS name, then remove a broken ACL rule, in a toy network.
cloud route53 test-dns-answer asks the DNS service what a name resolves to, without leaving the terminal: --hosted-zone-id, --record-name, --record-type. And cloud ec2 delete-network-acl-entry --network-acl-id A --ingress --rule-number N removes one numbered rule.
Commands taught
network-aclLevel 59: Site down at 04:40
Objective: www.shop.example is down: find who changed what, and get every ALB target healthy again without opening web-sg to the world.
Incident order: DNS (route53 test-dns-answer) → load balancer → target health (elbv2 describe-target-health) → network (SG, NACL) → what changed (CloudTrail). The Reason of an unhealthy target points at the broken layer.
Commands taught
incident-chainLevel 60: Edit only this block
Objective: Change only one ingress block of a Terraform file with a sed range, without touching its neighbours.
sed can act on a RANGE of lines: sed -n '3,5p' prints lines 3 to 5; sed '/start/,/end/s/old/new/' applies the s command only from the line matching /start/ to the next line matching /end/. Perfect for one block of a config file.
Level 61: Posture review
Objective: Close the three findings in ~/watch/posture/FINDINGS.txt by changing main.tf, apply, and end with a clean tf plan.
The final review: three findings in a Terraform stack, each fixed IN CODE, applied, and proven with a clean tf plan. A console fix (cloud … by hand) is drift: the next apply puts the hole back.
Commands taught
cloud-interview-card
World 6Open Forge
9 levelsThe same blueprints with an open-source tool, OpenTofu: read HCL like a pro, tidy and check it, move a Terraform project over and fix a broken stack.
Level 62: Same forge, open tool
Objective: Meet tofu in ~/forge/open/first: check its version, init, look at the files it makes, plan, apply, then count what the state tracks.
OpenTofu is the open-source fork of Terraform (Linux Foundation, MPL 2.0). The command is tofu instead of terraform; .tf files, terraform.tfstate, .terraform/ and .terraform.lock.hcl stay the same (SIM: tofu is built on the tf SIM of the Blueprint Forge).
Commands taught
tofutofu-vs-terraformLevel 63: Blocks, labels, braces
Objective: Write a resource block line by line in ~/forge/open/blocks, check it with hidden, then write a second block alone and apply.
HCL is made of blocks: the block type (resource), its labels in quotes ("cloud_s3_bucket" "logs"), then { to open the body. Inside, each argument is name = value, a } closes the block, and indentation does not matter to tofu (hidden tidies it later).
Commands taught
hcl-syntaxtofu-validateLevel 64: Strings, numbers, bools
Objective: Ask tofu console about each kind of value in ~/forge/open/types, then use a bool and a map in main.tf and apply.
Every value has a type: a string is text in double quotes ("web"), a number has no quotes (80), a bool is true or false, a list is ["a", "b"], a map is { Team = "forge" }. tofu console evaluates any expression, and type(...) names its type.
Commands taught
hcl-typestofu-consoleLevel 65: References and templates
Objective: In ~/forge/open/refs, look at a reference, the quoted trap and a template in tofu console, then wire subnet.tf to the VPC and apply.
A reference reads a value from another block: cloud_vpc.main.id (type, name, attribute, no quotes); in quotes it is just text. A template puts a value inside a string: "${cloud_vpc.main.tags.Name}-app".
Commands taught
hcl-templatesLevel 66: Variables, locals, outputs
Objective: In ~/forge/open/knobs read a variable and a local in tofu console, change the knob with -var, add an output, apply, then add a second output alone.
A variable block is an input knob, read as var.env. locals { name = ... } names a value you compute once, read as local.name. An output block prints a value after apply; tofu output NAME shows it later. -var env=prod changes a knob for one run.
Commands taught
hcl-variables-localstofu-outputLevel 67: Tidy and check
Objective: In ~/forge/open/tidy, check and preview the formatting, format the files, read the validate error, then fix it alone.
hidden rewrites files in the standard style: 2-space indent, = signs lined up. -check only reports (exit 3), -diff shows the change. hidden finds real mistakes (syntax, types, references). Read the first error, fix it, run it again.
Commands taught
tofu-fmtLevel 68: Move a project to tofu
Objective: Move ~/forge/open/legacy, built with tf (Terraform), to tofu: read its lock file, init, prove nothing changes, and count what the state tracks.
To move a Terraform project: back up the state, hidden (rewrites the lock file for registry.opentofu.org), then hidden must say No changes. OpenTofu-only settings can go in .tofu files: with x.tofu and x.tf, tofu reads x.tofu, terraform x.tf.
Commands taught
tofu-migrateLevel 69: Forge one alone
Objective: In ~/forge/open/own build a small stack from nothing (the full list is in the concept), keep hidden clean, then init and apply.
Write: variable env (string, default "dev"); a cloud_vpc 10.95.0.0/16 named "${var.env}-vpc"; a cloud_subnet 10.95.1.0/24 inside it named "${var.env}-app"; an output vpc_id with the VPC's id. provider.tf is already there.
Level 70: The broken forge
Objective: In ~/forge/open/broken the files are broken and a port was opened by hand: make hidden pass, delete nothing, then make the cloud match the code.
Fix in order: hidden shows one error at a time (syntax first, then types, then references); fix the line it names (or the line just above it), run it again. When the files are valid, hidden shows the drift and tofu apply puts the cloud back to the code.
World 7Real OpenTofu
6 levelsThe Surveyors' Guild: the real tofu binary on a lab machine with real providers, a real container and an encrypted state, no simulator and no internet.
Level 71: Install tofu by hand
Objective: Install the real tofu into ~/bin from http://registry.ptr:5000/pkg/tofu, verify it, and write its version number into /root/answer.
This terminal is a real lab machine with no internet, so tofu comes from the lab's mirror. Download the release and its checksum list, check the sum, unpack the binary into ~/bin and put ~/bin on your PATH.
Commands taught
tofu-real-installLevel 72: Providers without internet
Objective: In ~/survey/hello, see where providers come from, init and apply a real local_file, then add a second file alone.
hidden normally downloads providers from registry.opentofu.org. Here ~/.tofurc points provider_installation at a filesystem_mirror folder, so init installs the real hashicorp/local provider offline.
Commands taught
tofu-provider-mirrorLevel 73: Random names, stable state
Objective: In ~/survey/camp, init, read the lock file, apply a random_pet, see plans stay quiet, then force a new name and write it into /root/answer.
hashicorp/random makes random values once and keeps them in the state, so plans stay quiet. The lock file pins each provider's exact version and hash; -replace=ADDRESS forces one resource to be made again.
Commands taught
tofu-lock-replaceLevel 74: Lock the map
Objective: In ~/survey/vault, find the plain-text password in the state, switch on encryption (a .tofu file), rotate the password, and prove the state is unreadable.
State files hold secrets in plain text, and OpenTofu (not Terraform) can encrypt the state on your side: an encryption block with a key provider (pbkdf2 from a passphrase) and a method (aes_gcm). A fallback reads the old plain state once.
Commands taught
tofu-state-encryptionLevel 75: A container from a blueprint
Objective: In ~/survey/dock, init and apply a real nginx container, check it answers, then move it to port 8081 alone.
The kreuzwerker/docker provider drives a container engine through its API. Here it talks to this machine's podman socket, so docker_image pulls nginx from the lab registry and docker_container runs it on port 8080.
Commands taught
tofu-docker-providerLevel 76: The state file storm
Objective: In ~/survey/storm the files are broken and two surveyed files were deleted by hand: fix, read the plan, heal, and keep the same camp name.
Fix the files until hidden passes, read what hidden wants (the state still lists files someone deleted by hand), then apply until the plan is clean.
For teachers
Use these levels with a class
SOLUTION HIDDEN Teachers see answer keys in the classroom.