VPC Lattice Terraform

Infrastructure as Code

VPC Lattice Terraform Infrastructure

This directory contains Terraform modules and configurations for demonstrating AWS VPC Lattice service-to-service communication.

๐Ÿ“ Directory Structure

terraform/
โ”œโ”€โ”€ main.tf                 # Root Terraform configuration
โ”œโ”€โ”€ outputs.tf             # Root module outputs
โ”œโ”€โ”€ local.tf               # Local values and data sources
โ”œโ”€โ”€ versions.tf            # Terraform and provider version constraints
โ””โ”€โ”€ modules/
    โ”œโ”€โ”€ vpc/               # VPC module (3 VPCs: client, app1, app2)
    โ”œโ”€โ”€ ec2/               # EC2 notifications service
    โ”œโ”€โ”€ ec2_web_server/    # EC2 web server for VPC Lattice demo
    โ”œโ”€โ”€ ecs_fargate/       # ECS Fargate analytics service
    โ”œโ”€โ”€ lambda/            # Lambda functions
    โ””โ”€โ”€ vpc_lattice/       # VPC Lattice service network and services

๐Ÿš€ Quick Start

1. Initialize Terraform

cd terraform
terraform init

2. Review the configuration

terraform plan

3. Deploy the infrastructure

terraform apply

๐Ÿ—๏ธ Architecture Overview

This Terraform configuration creates a complete VPC Lattice demonstration environment:

  • 3 VPCs: Client, App1, and App2 VPCs for multi-VPC communication
  • EC2 Instances: Web servers and notification services
  • ECS Fargate: Containerized analytics service
  • VPC Lattice: Service network connecting all services
  • Lambda Functions: Serverless components

๐Ÿ“‹ Prerequisites

  • AWS CLI configured with appropriate permissions
  • Terraform >= 1.3
  • AWS Provider >= 6.0

๐Ÿ“Š Outputs

After deployment, you'll get:

  • VPC IDs and CIDR blocks
  • EC2 instance details
  • ECS service endpoints
  • VPC Lattice service network information

๐Ÿงน Cleanup

To destroy all resources:

terraform destroy