Compute Subnets With cidrsubnet
This machine has OpenTofu, the open-source tool that reads the same configuration language as Terraform. Run it as tofu (terraform runs the same program). There is no network: the local, random and null providers are already installed.
The network plan in /home/student/infra/indexer outputs subnet ranges per availability zone, but they're typed in by hand. When the team tried another vpc_cidr, the outputs didn't change.
Compute both outputs from var.vpc_cidr and var.azs (keys are the zone names, in list order i = 0, 1, 2, …):
| Output | For zone number i |
|---|---|
public_subnets | the i-th /24 of the VPC: 10.20.0.0/24, 10.20.1.0/24, … |
private_subnets | the /20 number i + 1: 10.20.16.0/20, 10.20.32.0/20, … (/20 number 0 holds the public /24s) |
The address 10.20. may appear only in the default of vpc_cidr. Apply.
About this machine
Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.
Part of Prepare for the Terraform Associate. Next step: A Validation Step Runs Too Early
Teaching or writing about this? Embed this lab on your page
Your machine is ready to start
A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.
No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.