One Resource per Item with for_each
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.
In /home/student/infra/pulse, three copy-pasted local_file resources each write a service config to /home/student/out/services/NAME.conf containing port=PORT. A fourth service is coming, and the copies already disagree.
local_file resource that uses for_each over a variable services, a map of service name to port.api = 8080, worker = 9090, web = 3000 and the new metrics = 9100.local_file.service["api"].port=PORT and a newline.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.
Your machine is ready to start
Create a free account to open a machine and get graded.