Requirements:
- Terraform 1.14.6
- Trivy >= 0.68.2
Trivy can be installed via Homebrew on macOS with the command:
brew install aquasecurity/trivy/trivy
A VPC Network module designed to be practical for casual use.
- VPC with DNS hostname and DNS resolution support
- Flexible subnet configuration via a single map variable (public, private, or
both)
- Internet Gateway provisioned automatically when public subnets exist
- NAT Gateway with Elastic IP for private subnet outbound internet access
- S3 Gateway VPC Endpoint with route table associations
- Optional Transit Gateway creation for hub-and-spoke network topologies
- Optional Transit Gateway VPC attachment with automatic private subnet
selection
- Cross-VPC routing via configurable CIDR-based Transit Gateway routes on both
public and private route tables
- Centralized NAT gateway sharing — spoke VPCs can skip local NAT and route
outbound internet traffic through a hub VPC's NAT via the Transit Gateway
- Trivy security scanning via pre-commit hooks
- Terratest integration tests for baseline and transit gateway deployments
- Configurable tags with default project and orchestrator metadata
| Name |
Version |
| aws |
>= 6.47.0 |
No modules.
| Name |
Description |
Type |
Default |
Required |
| additional_tags |
Additional tags to apply to the resources |
map(string) |
{} |
no |
| attach_to_transit_gateway |
Whether to attach this VPC to a Transit Gateway |
bool |
false |
no |
| create_nat_gateway |
Whether to create a NAT gateway for private subnet outbound internet access. Defaults to true (created when public subnets exist). Set to false for public-only VPCs (e.g. bastion or build hosts) that have no private subnets needing egress, avoiding the NAT gateway hourly + data processing cost. Ignored when use_centralized_nat is true. |
bool |
true |
no |
| create_transit_gateway |
Whether to create a new Transit Gateway |
bool |
false |
no |
| project_name |
Set the project name. |
string |
n/a |
yes |
| region |
Set the appropriate AWS region. |
string |
n/a |
yes |
| subnets |
Map of subnets to create. Each subnet should specify name, cidr_block, availability_zone, and type (public/private) |
map(object({ name = string cidr_block = string availability_zone = string type = string })) |
n/a |
yes |
| transit_gateway_asn |
Amazon side ASN for the Transit Gateway |
number |
64512 |
no |
| transit_gateway_id |
ID of an existing Transit Gateway to attach to (required if attach_to_transit_gateway is true and create_transit_gateway is false) |
string |
"" |
no |
| transit_gateway_name |
Name for the Transit Gateway (only used if create_transit_gateway is true) |
string |
"" |
no |
| transit_gateway_routes |
List of CIDR blocks to route through the Transit Gateway (e.g., other VPC CIDRs) |
list(string) |
[] |
no |
| use_centralized_nat |
If true, this VPC will NOT create its own NAT gateway. Instead, a default route (0.0.0.0/0) on private subnets will point to the Transit Gateway, expecting a hub VPC to provide NAT. Only applies when attach_to_transit_gateway is true. |
bool |
false |
no |
| vpc_cidr |
CIDR block for the VPC |
string |
n/a |
yes |
| vpc_name |
Name of the VPC |
string |
n/a |
yes |