23/53
Sign inSign up free

855. One Place for Shared Settings

medium 20 XP ~11 minHands-on lab

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.

Task

  • Define a local 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.
  • Create the files with one resource, 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 * * * *"
  • Each file /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.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

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.