vpc

Category Networking
Latest Version 0.1.0current

Some text goes here

Add to your Terraform configuration
module "vpc" {
  source  = "registry.patterneddesigns.ca/patterneddesigns/vpc/aws"
  version = "0.1.0"

  # Required inputs
  name = "..."
  vpc_cidr = "..."
  availability_zones = "..."
}

Overview

The vpc module creates a production-ready AWS VPC with:

  • Public and private subnets across multiple availability zones
  • NAT gateways for private subnet internet access
  • DNS hostnames and resolution enabled
  • Optional IPv6 support
  • Proper route tables and internet gateway

Category: Networking Provider: AWS Latest Version: 1.2.0

Quick Start

module "vpc" {
  source  = "registry.patterneddesigns.ca/patterneddesigns/vpc/aws"
  version = "1.2.0"

  availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c"]
}

Key Features

Multi-AZ Architecture

Subnets are automatically distributed across specified availability zones for high availability:

module "vpc" {
  source  = "registry.patterneddesigns.ca/patterneddesigns/vpc/aws"
  version = "1.2.0"

  vpc_cidr           = "10.0.0.0/16"
  availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c"]
}

NAT Gateway Options

Control NAT gateway deployment for cost optimization:

# High availability (default): One NAT gateway per AZ
module "vpc_ha" {
  source  = "registry.patterneddesigns.ca/patterneddesigns/vpc/aws"
  version = "1.2.0"

  availability_zones = ["us-east-1a", "us-east-1b"]
  enable_nat_gateway = true
  single_nat_gateway = false  # One per AZ
}

# Cost-optimized: Single NAT gateway
module "vpc_dev" {
  source  = "registry.patterneddesigns.ca/patterneddesigns/vpc/aws"
  version = "1.2.0"

  availability_zones = ["us-east-1a", "us-east-1b"]
  enable_nat_gateway = true
  single_nat_gateway = true  # Shared across AZs
}

# No NAT: Private subnets without internet access
module "vpc_isolated" {
  source  = "registry.patterneddesigns.ca/patterneddesigns/vpc/aws"
  version = "1.2.0"

  availability_zones = ["us-east-1a", "us-east-1b"]
  enable_nat_gateway = false
}

IPv6 Support

Enable dual-stack networking:

module "vpc" {
  source  = "registry.patterneddesigns.ca/patterneddesigns/vpc/aws"
  version = "1.2.0"

  availability_zones = ["us-east-1a", "us-east-1b"]
  enable_ipv6        = true
}

Documentation

Registry

View specification on Registry

Inputs

name Required
string

Name of the VPC. Used for resource naming and SSM parameter paths.

vpc_cidr Required
string

The IPv4 CIDR block for the VPC

list(string)

List of availability zones for subnet distribution

bool Default: true

Enable DNS hostnames in the VPC

Enable NAT gateways for private subnet internet access

bool Default: true

Use a single NAT gateway instead of one per AZ

Enable IPv6 support for the VPC and subnets

map(string)

Tags to apply to all resources

bool Default: true

Publish VPC metadata to SSM Parameter Store for discovery by other modules

Outputs

vpc_id

The ID of the VPC

vpc_cidr_block

The IPv4 CIDR block of the VPC

ipv6_cidr_block

The IPv6 CIDR block of the VPC (if enabled)

public_subnet_ids

List of public subnet IDs

private_subnet_ids

List of private subnet IDs

nat_gateway_ids

List of NAT gateway IDs

internet_gateway_id

The ID of the internet gateway

public_route_table_id

The ID of the public route table

private_route_table_ids

List of private route table IDs

ssm_parameter_paths

SSM parameter paths where VPC metadata is published