Files
terraform-aws-vpc-factory/README.md
T
2024-03-24 17:03:43 +01:00

4.5 KiB

Terraform module - VPC Factory

Usage

module "network" {
  source = "git:https://gitea.fillon.info/terraform-modules/terraform-aws-vpc-factory?ref=main"

  prefix               = "example"
  cidr_block           = "10.0.0.0/16"
  availability_zones   = ["eu-west-1a", "eu-west-1b"]
  network_acl_disabled = true

  subnet_groups = {
    dmz = {
      public     = true
      cidr_block = "10.0.0.0/26"
    }
    frontend = {
      cidr_block = "10.0.16.0/20"
    }
    backend = {
      cidr_block = "10.0.32.0/20"
    }
  }
}

By default, Network ACLs allow alltrafic. Set network_acl_disabled to false to block all trafic by default.

prefix is used in tag Name to identify resources created by this module.

If availability_zones is not specified, module use all availability zones in the target region.

cidr_block is mandatory for VPC, all subnet_groups must be given a cidr_block which wil be cut into several sub-blocks to have a subnet per availability zone on each groups. Group's _cidr_block must not overlap each others and must be included into VPC's cidr_block.

Requirements

Name Version
terraform >=1.0.0
aws >=4.0

Providers

Name Version
aws 5.33.0

Modules

No modules.

Resources

Name Type
aws_default_network_acl.self resource
aws_default_route_table.self resource
aws_default_security_group.self resource
aws_default_vpc_dhcp_options.self resource
aws_internet_gateway.self resource
aws_network_acl_rule.all_egress resource
aws_network_acl_rule.all_ingress resource
aws_route_table.public resource
aws_route_table_association.public resource
aws_subnet.self resource
aws_vpc.self resource
aws_availability_zones.current data source

Inputs

Name Description Type Default Required
availability_zones Target availability zones. list(string) null no
cidr_block The IPv4 CIDR block for the VPC. string n/a yes
network_acl_disabled If disabled, default Network ACLs allow all inbound and outbound protocols. bool true no
prefix Value used to prefix resources name. string "noname" no
subnet_groups One subnet in each availablity zone is created per subnet group.
map(object({
cidr_block = string
public = optional(bool, false)
}))
n/a yes

Outputs

Name Description
aws_availability_zones List of available AZ names.
subnet_ids Lisr of public subnet IDs.
vpc value