This workshop assumes you’re already familiar with the techniques and concepts in the Introduction & Key Concepts section. If you haven’t reviewed it yet, start with AWS Architecture and work your way through the rest of the section to fully understand the mechanics and philosophy behind our setup.
Overview
Why a wrapper? It standardizes patterns (networking, security, tagging) across
teams while keeping the underlying upstream module up-to-date. This example uses
a remote module from Git, demonstrating how teams can share reusable infrastructure
patterns across multiple projects.
This workshop walks you through deploying a pre-built wrapper module built on top of the official terraform-aws-modules/ec2-instance. The wrapper extends the base EC2 functionality with additional AWS components—such as an Application Load Balancer (ALB)—to create a complete, production-ready web application stack.
Prerequisites
- AWS SSO signed in:
aws sso login (see Getting Started with AWS SSO if you need help setting this up)
- Fast Foundation infrastructure repository cloned
- You know the target account / environment / region you’ll deploy to
- You have a VPC and at least one private subnet and one public subnet. Both tagged with “Type: Private/Public” according the case.
Module Structure
Remote Module Benefits: By referencing the module from Git, multiple teams can use
the same standardized wrapper while the module maintainers can update it centrally.
The ref=main ensures you’re using a specific version. Check the official documentation for more details.
The wrapper module is already created and available in the fast-foundation-examples repository provided by your team. Instead of creating local files, you’ll reference it directly from Git.
👉 Take a moment to explore the repository files to understand the structure and configuration you’ll be using them throughout this workshop.
Target folder (where to place your unit)
If your ec2 folder does not already exist, create it and add an _service.hcl file:
Now you’ll deploy this wrapper module into your infrastructure. To do this, you need to create two files in the appropriate folder:
- the deployment unit file → terragrunt.hcl
- the parameters file →
inputs.hcl
For this workshop, we’ll work in the development_workload_account account.
You can copy the examples below — terragrunt.hcl and inputs.hcl — into your module folder, following the structure shown in this file system tree:
Step 1 — Create terragrunt.hcl
This references the wrapper module from the fast-foundation-examples repository.
Parameter values are stored in Git. Update the VPC ID and subnet IDs with valid values from your environment.
Step 3 — Deploy the custom module
Run these commands from your new folder:
Cleanup
Important: Don’t forget to clean up the resources you created during this workshop to avoid unnecessary AWS charges. This deployment creates multiple resources including EC2 instances, Load Balancers, and Security Groups.
To destroy all resources created by the custom module, run the following command from your deployment folder:
When prompted, type yes to confirm the destruction of resources.
Notes & Options
Terragrunt Dependencies vs. Data Sources
If you prefer stronger guarantees about resource ordering (and want to avoid relying on data-source lookups), you can switch to using Terragrunt dependencies instead:
- Uncomment the dependency block in
terragrunt.hcl
- Update your module inputs to accept values like
vpc_id and subnet IDs directly
- Pass outputs such as
dependency.vpc.outputs.vpc_id into the module