TERRAForm LAUNCHPADINTERMEDIATE LAB
HANDS-ON AWS INFRASTRUCTURE

Build a reusable AWS VPC module.

Move beyond a single EC2 deployment. Design a custom network with public and private subnets, reusable Terraform code, remote state and separate development and production environments.

Explore the architecture ↓
Learning simulator, not a live terminal. This website provides explanations, code and commands. It does not execute Terraform, connect to AWS or create resources. Run the project locally after configuring AWS credentials.
01 / DESIGN

Understand what you're building

A small network foundation that can be reused by different environments.

AWS REGION · us-east-1
Custom VPC · 10.20.0.0/16
PUBLIC SUBNET10.20.1.0/24

Internet Gateway route

For resources requiring public connectivity
PRIVATE SUBNET10.20.2.0/24

Local VPC route only

No direct internet route in this lab

Route tables · associations · reusable module

Reusable Terraform VPC module
Called by separate dev and prod root configurations
02 / PREPARE

Before you begin

Important: The S3 backend bucket must already exist before terraform init. The dev and prod environments use different state keys. This project does not create the backend bucket.
03 / PROJECT

Project folder structure

terraform-intermediate-vpc/
├── modules/
│   └── vpc/
│       ├── main.tf
│       ├── variables.tf
│       └── outputs.tf
└── environments/
    ├── dev/
    │   ├── backend.tf
    │   ├── providers.tf
    │   ├── main.tf
    │   ├── variables.tf
    │   ├── outputs.tf
    │   └── terraform.tfvars
    └── prod/
        └── (same six files, separate values and state key)

Run Terraform from environments/dev or environments/prod. Each is an independent root module.

04 / CONFIGURE

Explore the Terraform files

Select a file, review the code, and copy it into the matching project path.

Network design note: The private subnet intentionally has no NAT Gateway or default internet route. Add NAT only if private workloads need outbound internet access; review hourly and data-processing charges first.
05 / RUN

Deployment workflow

1. Choose an environment

Open terraform/environments/dev.

2. Initialize

Install the AWS provider and configure the S3 backend.

3. Format and validate

Check syntax and configuration before planning.

4. Review the plan

Confirm account, region, CIDR ranges and resources.

5. Apply and verify

Deploy only after reviewing proposed changes.

6. Destroy the lab

Review the destroy plan before cleanup.

COMMAND SEQUENCE
cd terraform/environments/dev
terraform init
terraform fmt -recursive
terraform validate
terraform plan -var-file="terraform.tfvars"
terraform apply -var-file="terraform.tfvars"
Inspect the full plan. Confirm the CIDR ranges do not overlap with existing networks. Do not run dev and prod commands from the wrong directory.
06 / VERIFY & CLEAN UP

Check the result

CLEANUP COMMANDS
terraform output
terraform plan -destroy -var-file="terraform.tfvars"
terraform destroy -var-file="terraform.tfvars"

Destroy dev and prod separately. Destroying the VPC does not delete the S3 backend bucket or its state history.

07 / KNOWLEDGE CHECK

Quick knowledge check

WHAT COMES NEXT

From reusable networking to automated infrastructure.

The Advanced level adds workload modules, testing, secure authentication, policy checks and a protected CI/CD deployment pipeline.