Skip to main content

Palo Alto Networks Subnet-Set Module for AWS

A Terraform module for deploying a subnet-set in AWS cloud. The "set" means that the module will create an identical/similar subnet in each specified Availability Zone.

GitHub Logo Terraform Logo

Usage

module "vpc" {
source = "../../modules/vpc"

name = var.name
cidr_block = var.vpc_cidr_block
secondary_cidr_blocks = var.vpc_secondary_cidr_blocks
create_internet_gateway = true
global_tags = var.global_tags
vpc_tags = var.vpc_tags
security_groups = var.security_groups
}

module "subnet_sets" {
source = "../../modules/subnet_set"

for_each = toset(distinct([for _, v in var.subnets : v.set]))

name = each.key
cidrs = { for k, v in var.subnets : k => v if v.set == each.key }
vpc_id = module.vpc.id
}

Reference

Requirements

NameVersion
terraform>= 1.0.0, < 2.0.0
aws~> 5.17

Providers

NameVersion
aws~> 5.17

Modules

No modules.

Resources

NameType
aws_network_acl_association.mainresource
aws_route_table.sharedresource
aws_route_table.thisresource
aws_route_table_association.thisresource
aws_subnet.thisresource
aws_route_table.thisdata source
aws_subnet.thisdata source

Inputs

NameDescriptionTypeDefaultRequired
cidrsMap describing configuration of subnets and route tables to create and/or use in the set.
Keys are CIDR blocks, values can consist of following items:
- create_subnet - (Optional|bool) When true (default), subnet is created, otherwise existing one is used.
- create_route_table - (Optional|bool) When true a dedicated route table is created, unless existing subnet is used.
- associate_route_table - (Optional|bool) Unless set to false, route table is associated with the subnet.
- existing_route_table_id - (Optional|string) Id of an existing route table to associate with the subnet.
- name - (Optional|string) Name (tag) of a subnet and, optionally a route table, to create or use. Defaults to set name appended with zone letter id.
- route_table_name - (Optional|string) Name (tag) of a subnet and, optionally a route table, to create or use. Defaults to name value.
- local_tags - (Optional|map) Map of tags to assign to created resources.
map(any)n/ayes
create_shared_route_tableBoolean flag whether to create a shared route tables.boolfalseno
global_tagsOptional map of arbitrary tags to apply to all the created resources.map(string){}no
has_secondary_cidrsThe input that depends on the secondary CIDR ranges of the VPC vpc_id. The actual value (true or false) is ignored, the input is used only to delay subnet creation until the secondary CIDR ranges are processed by Terraform.booltrueno
map_public_ip_on_launchSee the provider's documentation.boolnullno
nacl_associationsNACLs associations with subnetsmap(string){}no
nameSubnet set name, used to construct default subnet names.stringnullno
propagating_vgwsSee the provider's documentation.list(string)[]no
vpc_idId of the VPC to create resource in.stringn/ayes

Outputs

NameDescription
availability_zonesn/a
route_tablesn/a
subnet_namesn/a
subnetsn/a
unique_route_table_idsn/a
vpc_idn/a