One Place for Shared Settings
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.
/home/student/infra/relay writes one .env file per service with three copy-pasted local_file resources. They have drifted: cron runs in the wrong region.
common map with the shared settings LOG_LEVEL = "info", OWNER = "platform" and REGION = "eu-west-1". The texts eu-west-1 and platform must each appear only once in your .tf files.local_file.service, using for_each over the services api, worker and cron. Each file is the common settings merged with the service's own:
api: PORT = "8080"worker: LOG_LEVEL = "debug" (overrides the common value) and QUEUE = "jobs"cron: SCHEDULE = "*/15 * * * *"/home/student/out/env/<service>.env has one KEY=value line per setting, sorted by key, ending with a newline.Apply. A new plan must show no changes.
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: Optional Object Attributes With Defaults
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.