Private Route Table
π¦ Overviewβ
This Terraform module provisions a private AWS Route Table within a specified VPC and associates it with one or more private subnets.
Itβs designed for routing outbound traffic from internal AWS resourcesβlike EC2 instances or backend servicesβvia NAT Gateways or VPC endpoints, without exposing them directly to the internet.
β Key Featuresβ
- Creates a route table scoped for private subnets
- Associates it with one or more private subnet IDs
- Adds standard environment-based tagging
- Modular and reusable across internal network tiers
πΌ Use Casesβ
- Routing backend traffic through NAT Gateways
- Supporting isolated compute layers in a 3-tier architecture
- Defining private communication paths within a VPC
- Setting up subnet-specific routing in microservice environments
π₯ Input Variablesβ
| Name | Type | Description |
|---|---|---|
| region | string | AWS region for the route table deployment |
| vpc_id | string | The ID of the VPC where the route table will be created |
| subnet_ids | list | List of subnet IDs to associate with the private route table |
| environment | string | Tag to specify the deployment environment (e.g., dev, prod, test) |
π€ Outputsβ
| Name | Description |
|---|---|
| route_table_id | The ID of the created private route table |
π Deployment Readinessβ
- β Compatible with Terraform 1.0+
- β Tested with AWS provider 5.x
- π§ͺ Requires IAM permissions for VPC and Route Table management
π οΈ Example Usageβ
module "route_table_private" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//network/route-table-private?ref=v1.0.0"
region = "us-east-1"
vpc_id = "vpc-0123456789abcdef0"
subnet_ids = ["subnet-abc123", "subnet-def456"]
environment = "dev"
}
terraform init
terraform plan
terraform apply
or
tofu init
tofu plan
tofu apply
π§Ή Cleanup Optionsβ
Terraform Destroy (for testing):
terraform destroy
or
tofu destroy
Manual Deletion (for production):
Delete via AWS Console or CLI only after verifying itβs not in use by critical subnets:
aws ec2 delete-route-table --route-table-id "route_table_id"
π‘οΈ Notesβ
This is a Level 1 module optimized for use with private subnets. To complete routing behavior, consider adding: aws_route resources that point to a NAT Gateway or VPC endpoint VPC flow logs or security group rules for internal visibility and protection
π Deployment Package Noticeβ
This module is part of the Level 1 AWS License Tier. To access the full deployment package and source code, subscribe to Archiphire.