Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for enabling IPv6 in VPCs #1193

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions modules/vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ locals {
security_group_ids = [module.endpoint_security_groups[local.interface_endpoint_security_group_key].id]
subnet_ids = module.subnets.private_subnet_ids
} }

vpc_ipv6_cidr_blocks = compact(concat([module.vpc.vpc_ipv6_cidr_block], module.vpc.additional_ipv6_cidr_blocks))
}

module "utils" {
Expand Down Expand Up @@ -114,7 +116,7 @@ module "endpoint_security_groups" {
to_port = 65535
protocol = "-1" # allow ping
cidr_blocks = compact(concat([module.vpc.vpc_cidr_block], module.vpc.additional_cidr_blocks))
ipv6_cidr_blocks = compact(concat([module.vpc.vpc_ipv6_cidr_block], module.vpc.additional_ipv6_cidr_blocks))
ipv6_cidr_blocks = local.vpc_ipv6_cidr_blocks
description = "Ingress from VPC to ${each.value}"
}]
}
Expand Down Expand Up @@ -145,7 +147,9 @@ module "subnets" {
availability_zone_ids = local.availability_zone_ids
ipv4_cidr_block = [module.vpc.vpc_cidr_block]
ipv4_cidrs = var.ipv4_cidrs
ipv6_enabled = false
ipv6_enabled = length(local.vpc_ipv6_cidr_blocks) > 0
disable_private_ipv6 = var.disable_private_ipv6
disable_public_ipv6 = var.disable_public_ipv6
igw_id = var.public_subnets_enabled ? [module.vpc.igw_id] : []
map_public_ip_on_launch = var.map_public_ip_on_launch
max_subnet_count = local.max_subnet_count
Expand Down
12 changes: 12 additions & 0 deletions modules/vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ variable "ipv4_cidrs" {
}
}

variable "disable_private_ipv6" {
type = bool
default = false
description = "Allow for selectively disabling IPv6 addresses in private subnets only"
}

variable "disable_private_ipv6" {
type = bool
default = false
description = "Allow for selectively disabling IPv6 addresses in public subnets only"
}

variable "assign_generated_ipv6_cidr_block" {
type = bool
description = "When `true`, assign AWS generated IPv6 CIDR block to the VPC. Conflicts with `ipv6_ipam_pool_id`."
Expand Down