terraform.aws-baseline-infra/modules/networking/vpc-subnet-manual
2023-12-07 18:02:39 +08:00
..
main.tf UPD: module now supports more than 2 AZs. Still defaults to 2 for compatibility 2023-12-07 18:02:39 +08:00
outputs.tf UPD: updated vpc and vpcep modules to support provider default tags 2023-07-12 20:37:30 +08:00
README.md DOC: updated readme with example 2023-07-12 23:04:58 +08:00
variables.tf UPD: module now supports more than 2 AZs. Still defaults to 2 for compatibility 2023-12-07 18:02:39 +08:00
vpc-flowlog.tf FIX: flowlog role and policy name change 2023-07-13 07:48:49 +08:00

Overview

This module performs the following tasks:

  • Create VPC, vpcflow log
  • Create subnets in every AZ
  • Create IGW, NGW
  • Create s3 and ddb endpoints which are free

Subnet addressing

Subnet cidrs needs to be specified manually

Inputs:

Name Description Type Default Required
private-subnet-cidrs private subnets list [] yes
public-subnet-cidrs public subnets list [] yes
create-nat-gateway whether to deploy NAT gateway for private subnets bool true yes
vpc-cidr VPC cidr string none yes
enable-flowlog whether to enable vpc flowlog bool true yes
vpcflowlog-retain-days number of days to retain vpc cloudwatch log number 90 yes
vpcflowlog-cwl-loggroup-key-arn kms key alias arn for log group encryption string none yes
secondary_cidr_blocks Additional CIDR blocks to be associated with VPC list(string) none no
resource-prefix Prefix of resource name string "" yes

Outputs:

Name Description Type
vpc_id vpc id string
public_subnets list of cidr blocks list
private_subnets list of cidr blocks list
secondary_cidr_blocks list of secondary cidrs list

Example:

module "vpc-subnets" {
  source = "../../modules/networking/vpc-subnet-manual"

  resource-prefix                 = local.resource-prefix
  private-subnet-cidrs            = ["172.17.0.0/24", "172.17.1.0/24"]
  public-subnet-cidrs             = ["172.17.10.0/24", "172.17.11.0/24"]
  vpc-cidr                        = "172.17.0.0/16"
  enable-flow-log                 = false
  vpcflowlog-cwl-loggroup-key-arn = ""
  create-nat-gateway              = true
  create-free-vpc-endpoints       = true
}