Challenge LabIntermediate

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.

40 minEstimated time
1Guided step
AutoVerification
IsolatedSandbox
Challenge - Build and Use a Custom Terraform Module

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.

[CHECK] validation_activelive
Inspecting deployed resources...
Verifying configuration state...
✓ Step requirements satisfied

More labs like this

PremiumIncluded in Premium
Duration
40 min
Steps
1

Environment

Browser Code IDELive Cloud Environment

Every lab includes

  • Real environment, pre-credentialed
  • Automated checks on every step
  • Isolated sandbox, auto cleanup
  • AI-recommended next steps

Lab curriculum

  1. 01

    Challenge Scenario - Build a Reusable App-Tier Module and Deploy Two Tiers

    4 automated checks

Skills validated

TerraformAmazon EC2Amazon VPCTerraform Modules

Not the lab you were looking for?

Browse 200+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.

Explore the catalog