This module deploys a 3-tier VPC. The following resources are managed:
- VPC
- Subnets
- Routes
- NACLs
- Internet Gateway
- NAT Gateways
- Virtual Private Gateway
- DHCP Option Sets
- VPC Endpoints
- RDS/EC/Redshift Subnet Groups
Tags on VPCs/Subnets are currently set to ignore changes. This is to support EKS clusters.
Terraform >= 0.12 is required for this module.
CIDR ranges are automatically calculated using Terraform's cidrsubnet()
function. The default configuration results in equal-sized tiers that are -/2 smaller than the VPC. (A /16 VPC becomes a /18 tier.) Subnets are calculated with tierCIDR-/2. (A /18 tier becomes /20 subnets.) The number of subnets is determined by the number of availability_zones
specified.
In the event that you do not want this topology, you can configure the x_tier_newbits
and x_subnet_newbits
options found in the inputs.
NACLs in addition to the ones with input options can be added using the nacl_x_custom
maps. The object schema is:
object(
key = object({
rule_number = number,
egress = bool,
protocol = number,
rule_action = string,
cidr_block = string,
from_port = string,
to_port = string
})
key = ...
)
The following requirements are needed by this module:
-
terraform ( >= 0.12.26)
-
aws (>= 2.8.1)
The following input variables are required:
Description: List of availability zones
Type: list(string)
Description: The CIDR block of the VPC
Type: string
Description: Name that will be prefixed to resources
Type: string
The following input variables are optional (have default values):
Description: Custom DHCP options
Type:
object({
domain_name = string,
domain_name_servers = list(string),
ntp_servers = list(string),
netbios_name_servers = list(string),
netbios_node_type = number
})
Default:
{
"domain_name": null,
"domain_name_servers": null,
"netbios_name_servers": null,
"netbios_node_type": null,
"ntp_servers": null
}
Description: Enable custom DHCP options, you must specify custom_dhcp_options
Type: bool
Default: false
Description: Create the secure DB VPC subnet group
Type: bool
Default: true
Description: Create the secure Elasticache VPC subnet group
Type: bool
Default: true
Description: Attach an internet gateway to the VPC
Type: bool
Default: true
Description: Create nat gateways in the VPC,
Type: bool
Default: true
Description: Create 1 nat gateway per AZ
Type: bool
Default: true
Description: Create the secure Redshift VPC subnet group
Type: bool
Default: true
Description: Attach a virtual private gateway to the VPC
Type: bool
Default: false
Description: Add a rule to all NACLs allowing all ephemeral ports
Type: bool
Default: true
Description: Add a rule to all NACLs allowing http egress
Type: bool
Default: true
Description: Add a rule to all NACLs allowing https egress
Type: bool
Default: true
Description: Add a rule to all NACLs allowing all traffic to/from the vpc cidr
Type: bool
Default: true
Description: Block all traffic between public and secure tiers
Type: bool
Default: false
Description: List of custom nacls to apply to the private tier
Type: map
Default: {}
Description: List of custom nacls to apply to the public tier
Type: map
Default: {}
Description: List of custom nacls to apply to the secure tier
Type: map
Default: {}
Description: newbits value for calculating the private subnet size
Type: number
Default: 2
Description: netnum value for calculating the private tier cidr
Type: number
Default: 1
Description: newbits value for calculating the private tier size
Type: number
Default: 2
Description: newbits value for calculating the public subnet size
Type: number
Default: 2
Description: netnum value for calculating the public tier cidr
Type: number
Default: 0
Description: newbits value for calculating the public tier size
Type: number
Default: 2
Description: newbits value for calculating the secure subnet size
Type: number
Default: 2
Description: netnum value for calculating the secure tier cidr
Type: number
Default: 2
Description: newbits value for calculating the secure tier size
Type: number
Default: 2
Description: Tags applied to all resources
Type: map(string)
Default: {}
Description: ASN for the Amazon side of the VPG
Type: number
Default: 64512
Description: Enable VPC DNS hostname resolution
Type: bool
Default: true
Description: Enable VPC DNS resolver
Type: bool
Default: true
Description: List of VPC Interface endpoints
Type: list(string)
Default: []
Description: List of VPC Gateway endpoints
Type: list(string)
Default: []
The following outputs are exported:
Description: Name of db subnet group
Description: Name of elasticache subnet group
Description: List of route table ids for the private tier
Description: Private tier CIDR range
Description: List of subnet ids for the private tier
Description: List of route table ids for the public tier
Description: Public tier CIDR range
Description: List of subnet ids for the public tier
Description: Name of redshift subnet group
Description: List of route table ids for the secure tier
Description: Secure tier CIDR range
Description: List of subnet ids for the secure tier
Description: VPC ID