Skip to main content
This page documents all input variables available for configuring the VPC module.

Core Configuration

name
string
default:""
Name to be used on all the resources as identifier. This value is used as a prefix for resource names.Example: my-vpc
cidr
string
default:""
required
The CIDR block for the VPC.Example: 10.0.0.0/16
instance_tenancy
string
default:"default"
A tenancy option for instances launched into the VPC.Valid values: default, dedicated, host
azs
list
default:"[]"
A list of Availability zones in the region.Example: ["us-east-1a", "us-east-1b", "us-east-1c"]

Subnet Configuration

public_subnets
list
default:"[]"
A list of public subnets inside the VPC. Each subnet will be created in the corresponding availability zone from the azs variable.Example: ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
private_subnets
list
default:"[]"
A list of private subnets inside the VPC. Each subnet will be created in the corresponding availability zone from the azs variable.Example: ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
database_subnets
list
default:"[]"
A list of database subnets. Each subnet will be created in the corresponding availability zone from the azs variable.Example: ["10.0.201.0/24", "10.0.202.0/24", "10.0.203.0/24"]
elasticache_subnets
list
default:"[]"
A list of elasticache subnets. Each subnet will be created in the corresponding availability zone from the azs variable.Example: ["10.0.301.0/24", "10.0.302.0/24", "10.0.303.0/24"]

DNS Configuration

enable_dns_hostnames
bool
default:"false"
Should be true if you want to use private DNS within the VPC. When enabled, instances launched in the VPC receive DNS hostnames.
enable_dns_support
bool
default:"false"
Should be true if you want to use private DNS within the VPC. When enabled, the Amazon provided DNS server is enabled.

NAT Gateway Configuration

enable_nat_gateway
bool
default:"false"
Should be true if you want to provision NAT Gateways for each of your private networks. This enables private subnets to access the internet.
single_nat_gateway
bool
default:"false"
Should be true if you want to provision a single shared NAT Gateway across all of your private networks. When false and enable_nat_gateway is true, one NAT Gateway is created per availability zone.Note: Setting this to true reduces costs but creates a single point of failure.

VPC Endpoints

enable_s3_endpoint
bool
default:"false"
Should be true if you want to provision an S3 endpoint to the VPC. This allows resources in the VPC to access S3 without going through the internet gateway.
enable_dynamodb_endpoint
bool
default:"false"
Should be true if you want to provision a DynamoDB endpoint to the VPC. This allows resources in the VPC to access DynamoDB without going through the internet gateway.

Subnet Groups

create_database_subnet_group
bool
default:"true"
Controls if database subnet group should be created. When true and database_subnets are provided, an RDS subnet group will be created.

Network Configuration

map_public_ip_on_launch
bool
default:"true"
Should be false if you do not want to auto-assign public IP on launch for instances in public subnets.
private_propagating_vgws
list
default:"[]"
A list of Virtual Private Gateways (VGWs) the private route table should propagate. Used for VPN connections.Example: ["vgw-12345678"]
public_propagating_vgws
list
default:"[]"
A list of Virtual Private Gateways (VGWs) the public route table should propagate. Used for VPN connections.Example: ["vgw-12345678"]

Tagging

tags
map
default:"{}"
A map of tags to add to all resources created by the module.Example:
{
  Environment = "production"
  Project     = "my-project"
  ManagedBy   = "terraform"
}
public_subnet_tags
map
default:"{}"
Additional tags for the public subnets. These tags are merged with the tags variable.Example:
{
  Tier = "public"
  "kubernetes.io/role/elb" = "1"
}
private_subnet_tags
map
default:"{}"
Additional tags for the private subnets. These tags are merged with the tags variable.Example:
{
  Tier = "private"
  "kubernetes.io/role/internal-elb" = "1"
}
database_subnet_tags
map
default:"{}"
Additional tags for the database subnets. These tags are merged with the tags variable.Example:
{
  Tier = "database"
}
elasticache_subnet_tags
map
default:"{}"
Additional tags for the elasticache subnets. These tags are merged with the tags variable.Example:
{
  Tier = "cache"
}

Build docs developers (and LLMs) love