Refactor a Reusable Service Module
Replace duplicated infrastructure with variables, outputs, and two local module calls.
A intermediate Linux challenge worth 10 points. Solve it hands-on in a real Linux environment in your browser - no local setup, no fake shells.
The Challenge
Refactor request: /home/labuser/terraform-lab/main.tf contains duplicated dev and prod instance-plus-DNS stacks.
Create a reusable module at modules/service/ with separate main.tf, variables.tf, and outputs.tf. Parameterize the service name, size, region, and DNS TTL; output at least the instance IP. Replace the four root resources with two module calls while preserving catalog-dev (small, lab-east, TTL 300) and catalog-prod (large, lab-west, TTL 60). Initialize and apply, then run check.