Skip to content

Commit 90df852

Browse files
Extend variables to have 2 for using IPAM - for IPv4 and IPv6
1 parent 573f574 commit 90df852

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,8 @@ No modules.
580580
| <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 |
581581
| <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 |
582582
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |
583-
| <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 |
583+
| <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 |
584+
| <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 |
584585
| <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 |
585586
| <a name="input_vpc_flow_log_iam_policy_use_name_prefix"></a> [vpc\_flow\_log\_iam\_policy\_use\_name\_prefix](#input\_vpc\_flow\_log\_iam\_policy\_use\_name\_prefix) | Determines whether the name of the IAM policy (`vpc_flow_log_iam_policy_name`) is used as a prefix | `bool` | `true` | no |
586587
| <a name="input_vpc_flow_log_iam_role_name"></a> [vpc\_flow\_log\_iam\_role\_name](#input\_vpc\_flow\_log\_iam\_role\_name) | Name to use on the VPC Flow Log IAM role created | `string` | `"vpc-flow-log-role"` | no |

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ locals {
2828
resource "aws_vpc" "this" {
2929
count = local.create_vpc ? 1 : 0
3030

31-
cidr_block = var.use_ipam_pool ? null : var.cidr
31+
cidr_block = var.use_ipv4_ipam_pool ? null : var.cidr
3232
ipv4_ipam_pool_id = var.ipv4_ipam_pool_id
3333
ipv4_netmask_length = var.ipv4_netmask_length
3434

35-
assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null
35+
assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipv6_ipam_pool ? true : null
3636
ipv6_cidr_block = var.ipv6_cidr
3737
ipv6_ipam_pool_id = var.ipv6_ipam_pool_id
3838
ipv6_netmask_length = var.ipv6_netmask_length

variables.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ variable "enable_network_address_usage_metrics" {
5656
default = null
5757
}
5858

59-
variable "use_ipam_pool" {
60-
description = "Determines whether IPAM pool is used for CIDR allocation"
59+
variable "use_ipv4_ipam_pool" {
60+
description = "Determines whether IPAM pool is used for IPv4 CIDR allocation"
6161
type = bool
6262
default = false
6363
}
@@ -80,6 +80,12 @@ variable "enable_ipv6" {
8080
default = false
8181
}
8282

83+
variable "use_ipv6_ipam_pool" {
84+
description = "Determines whether IPAM pool is used for IPv6 CIDR allocation"
85+
type = bool
86+
default = false
87+
}
88+
8389
variable "ipv6_cidr" {
8490
description = "(Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length`"
8591
type = string

0 commit comments

Comments
 (0)