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

feat!: Add ability to configure IPAM exclusively for IPv4 or IPv6 #1155

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,8 @@ No modules.
| <a name="input_secondary_cidr_blocks"></a> [secondary\_cidr\_blocks](#input\_secondary\_cidr\_blocks) | List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool | `list(string)` | `[]` | no |
| <a name="input_single_nat_gateway"></a> [single\_nat\_gateway](#input\_single\_nat\_gateway) | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` | `false` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |
| <a name="input_use_ipam_pool"></a> [use\_ipam\_pool](#input\_use\_ipam\_pool) | Determines whether IPAM pool is used for CIDR allocation | `bool` | `false` | no |
| <a name="input_use_ipv4_ipam_pool"></a> [use\_ipv4\_ipam\_pool](#input\_use\_ipv4\_ipam\_pool) | Determines whether IPAM pool is used for IPv4 CIDR allocation | `bool` | `false` | no |
| <a name="input_use_ipv6_ipam_pool"></a> [use\_ipv6\_ipam\_pool](#input\_use\_ipv6\_ipam\_pool) | Determines whether IPAM pool is used for IPv6 CIDR allocation | `bool` | `false` | no |
| <a name="input_vpc_block_public_access_exclusions"></a> [vpc\_block\_public\_access\_exclusions](#input\_vpc\_block\_public\_access\_exclusions) | A map of VPC block public access exclusions | `map(any)` | `{}` | no |
| <a name="input_vpc_block_public_access_options"></a> [vpc\_block\_public\_access\_options](#input\_vpc\_block\_public\_access\_options) | A map of VPC block public access options | `map(string)` | `{}` | no |
| <a name="input_vpc_flow_log_iam_policy_name"></a> [vpc\_flow\_log\_iam\_policy\_name](#input\_vpc\_flow\_log\_iam\_policy\_name) | Name of the IAM policy | `string` | `"vpc-flow-log-to-cloudwatch"` | no |
Expand Down
12 changes: 6 additions & 6 deletions examples/ipam/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module "vpc_ipam_set_netmask" {

name = "${local.name}-set-netmask"

use_ipam_pool = true
use_ipv4_ipam_pool = true
ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id
ipv4_netmask_length = 16
azs = local.azs
Expand All @@ -48,10 +48,10 @@ module "vpc_ipam_set_cidr" {

name = "${local.name}-set-cidr"

use_ipam_pool = true
ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id
cidr = "10.1.0.0/16"
azs = local.azs
use_ipv4_ipam_pool = true
ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id
cidr = "10.1.0.0/16"
azs = local.azs

private_subnets = ["10.1.1.0/24", "10.1.2.0/24", "10.1.3.0/24"]
public_subnets = ["10.1.11.0/24", "10.1.12.0/24", "10.1.13.0/24"]
Expand All @@ -65,7 +65,7 @@ module "vpc_ipam_set_cidr" {

# name = "${local.name}-ipv6-set-netmask"

# use_ipam_pool = true
# use_ipv4_ipam_pool = true
# ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id
# ipv6_ipam_pool_id = aws_vpc_ipam_pool.ipv6.id
# ipv6_netmask_length = 56
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ locals {
resource "aws_vpc" "this" {
count = local.create_vpc ? 1 : 0

cidr_block = var.use_ipam_pool ? null : var.cidr
cidr_block = var.use_ipv4_ipam_pool ? null : var.cidr
ipv4_ipam_pool_id = var.ipv4_ipam_pool_id
ipv4_netmask_length = var.ipv4_netmask_length

assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null
assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipv6_ipam_pool ? true : null
ipv6_cidr_block = var.ipv6_cidr
ipv6_ipam_pool_id = var.ipv6_ipam_pool_id
ipv6_netmask_length = var.ipv6_netmask_length
Expand Down
10 changes: 8 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ variable "enable_network_address_usage_metrics" {
default = null
}

variable "use_ipam_pool" {
description = "Determines whether IPAM pool is used for CIDR allocation"
variable "use_ipv4_ipam_pool" {
description = "Determines whether IPAM pool is used for IPv4 CIDR allocation"
type = bool
default = false
}
Expand All @@ -80,6 +80,12 @@ variable "enable_ipv6" {
default = false
}

variable "use_ipv6_ipam_pool" {
description = "Determines whether IPAM pool is used for IPv6 CIDR allocation"
type = bool
default = false
}

variable "ipv6_cidr" {
description = "(Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length`"
type = string
Expand Down