Protect a Resource from Deletion

medium 20 XP ~7 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.

In /home/student/infra/courier, random_password.master is the master key of a production database: if it is ever destroyed, the data is lost. The null_resource.registration records an owner that the database team changes in their own system, and it should not be put back by every apply.

Task

  • Make any plan that would destroy random_password.master fail with an error.
  • Changing owner in the code must not cause null_resource.registration to be replaced or updated.
  • The current resources stay as they are (same master key). A plan with the current code reports 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.

TerminalNot started

Your machine is ready to start

Create a free account to open a machine and get graded.