Challenge - Build and Use a Custom Terraform Module
Build a reusable Terraform module for EC2 app tiers and deploy web and API instances using the module in AWS.

Lab overview
A Terraform module packages a repeatable pattern, inputs, resources, and outputs, into a directory you can call from many configurations. Instead of copying the same EC2 and security-group blocks for every application tier, you define the pattern once and pass in the values that differ: image, size, subnet, a name, and the port to open. Each call gets its own resources, and the root configuration re-exports whatever instance IDs and addresses callers need.
That reusability is the difference between a one-off script and infrastructure you can review, version, and scale. Child modules keep the implementation in one place; the root stays a short list of calls and outputs.
By completing this Intermediate challenge, you will be able to:
- Design a reusable Terraform module with well-chosen inputs, resources, and outputs
- Parameterize one module definition so it can stand up multiple distinct tiers
- Invoke a child module more than once from a root configuration
- Surface child-module results through root-level outputs
Prerequisites
Before attempting this challenge, you should be comfortable with:
- Writing and editing Terraform configuration files (HCL syntax)
- Declaring AWS EC2 instances and security groups in Terraform
- The core Terraform workflow (init, plan, apply)
- Terraform modules, input variables, and outputs
Verified against your live environment
An automated validation engine inspects your actual resources and configurations as you work. Completion means the task was performed, not multiple choice, real-world proficiency.
More labs like this
Introduction to Infrastructure as Code with Terraform on AWS
Write your first HCL configuration and deploy a DynamoDB table to AWS using Terraform's init, plan, and apply workflow.
Terraform Custom Validation and Check Blocks on AWS
Write variable validation rules, add preconditions and postconditions to resources, attach output preconditions, and create check blocks on AWS.
Challenge - Import and Refactor Existing Infrastructure with Terraform
Bring pre-existing Azure resources under Terraform management without recreating them, reconcile your configuration to a zero-change plan, then refactor the storage account into a reusable module.
Environment
Every lab includes
- Real environment, pre-credentialed
- Automated checks on every step
- Isolated sandbox, auto cleanup
- AI-recommended next steps
Lab curriculum
- 01
Challenge Scenario - Build a Reusable App-Tier Module and Deploy Two Tiers
4 automated checks
Skills validated
Not the lab you were looking for?
Browse 200+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.