You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-18Lines changed: 25 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -68,22 +68,29 @@ Passing the IPs into the module is done by setting two variables `reuse_nat_ips
68
68
69
69
This module supports three scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.
70
70
71
-
- One NAT Gateway per subnet (default behavior)
72
-
-`enable_nat_gateway = true`
73
-
-`single_nat_gateway = false`
74
-
-`one_nat_gateway_per_az = false`
75
-
- Single NAT Gateway
71
+
-**Single NAT Gateway** (cost-saving):
76
72
-`enable_nat_gateway = true`
77
73
-`single_nat_gateway = true`
78
-
-`one_nat_gateway_per_az = false`
79
-
- One NAT Gateway per availability zone
74
+
-`one_nat_gateway_per_az = false` (or true — has no effect)
75
+
- ✅ Creates one NAT Gateway shared across all private subnets
76
+
77
+
-**One NAT Gateway per Availability Zone** (high availability):
80
78
-`enable_nat_gateway = true`
81
79
-`single_nat_gateway = false`
82
80
-`one_nat_gateway_per_az = true`
81
+
- ✅ Creates one NAT Gateway in each AZ you specify in `var.azs`
82
+
83
+
-**Default (no special config):**
84
+
-`enable_nat_gateway = true`
85
+
-`single_nat_gateway = false`
86
+
-`one_nat_gateway_per_az = false`
87
+
- ✅ Behavior depends on private subnet layout — only one NAT Gateway is created unless multiple are required
83
88
84
-
If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence.
89
+
> ⚠️ **Important:** If both `single_nat_gateway = true` and `one_nat_gateway_per_az = true` are set,
90
+
> the module will **only create one NAT Gateway**.
91
+
> The `single_nat_gateway` setting takes precedence and overrides `one_nat_gateway_per_az`.
85
92
86
-
### One NAT Gateway per subnet (default)
93
+
### NAT Gateway Behavior Overview
87
94
88
95
By default, the module will determine the number of NAT Gateways to create based on the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:
89
96
@@ -487,13 +494,13 @@ No modules.
487
494
| <aname="input_intra_subnet_names"></a> [intra\_subnet\_names](#input\_intra\_subnet\_names)| Explicit values to use in the Name tag on intra subnets. If empty, Name tags are generated |`list(string)`|`[]`| no |
488
495
| <aname="input_intra_subnet_private_dns_hostname_type_on_launch"></a> [intra\_subnet\_private\_dns\_hostname\_type\_on\_launch](#input\_intra\_subnet\_private\_dns\_hostname\_type\_on\_launch)| The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name`|`string`|`null`| no |
489
496
| <aname="input_intra_subnet_suffix"></a> [intra\_subnet\_suffix](#input\_intra\_subnet\_suffix)| Suffix to append to intra subnets name |`string`|`"intra"`| no |
490
-
| <aname="input_intra_subnet_tags"></a> [intra\_subnet\_tags](#input\_intra\_subnet\_tags)| Additional tags for the intra subnets |`map(string)`|`{}`| no |
497
+
| <aname="input_intra\_subnet\_tags"></a> [intra\_subnet\_tags](#input\_intra\_subnet\_tags)| Additional tags for the intra subnets |`map(string)`|`{}`| no |
491
498
| <aname="input_intra_subnets"></a> [intra\_subnets](#input\_intra\_subnets)| A list of intra subnets inside the VPC |`list(string)`|`[]`| no |
492
499
| <aname="input_ipv4_ipam_pool_id"></a> [ipv4\_ipam\_pool\_id](#input\_ipv4\_ipam\_pool\_id)| (Optional) The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR |`string`|`null`| no |
493
500
| <aname="input_ipv4_netmask_length"></a> [ipv4\_netmask\_length](#input\_ipv4\_netmask\_length)| (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a ipv4\_ipam\_pool\_id |`number`|`null`| no |
494
501
| <aname="input_ipv6_cidr"></a> [ipv6\_cidr](#input\_ipv6\_cidr)| (Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length`|`string`|`null`| no |
495
502
| <aname="input_ipv6_cidr_block_network_border_group"></a> [ipv6\_cidr\_block\_network\_border\_group](#input\_ipv6\_cidr\_block\_network\_border\_group)| By default when an IPv6 CIDR is assigned to a VPC a default ipv6\_cidr\_block\_network\_border\_group will be set to the region of the VPC. This can be changed to restrict advertisement of public addresses to specific Network Border Groups such as LocalZones |`string`|`null`| no |
496
-
| <aname="input_ipv6_ipam_pool_id"></a> [ipv6\_ipam\_pool\_id](#input\_ipv6\_ipam\_pool\_id)| (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block`|`string`|`null`| no |
503
+
| <aname="input_ipv6_ipam_pool_id"></a> [ipv6\_ipam\_pool_id](#input\_ipv6\_ipam\_pool\_id)| (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block`|`string`|`null`| no |
497
504
| <aname="input_ipv6_netmask_length"></a> [ipv6\_netmask\_length](#input\_ipv6\_netmask\_length)| (Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56`|`number`|`null`| no |
498
505
| <aname="input_manage_default_network_acl"></a> [manage\_default\_network\_acl](#input\_manage\_default\_network\_acl)| Should be true to adopt and manage Default Network ACL |`bool`|`true`| no |
499
506
| <aname="input_manage_default_route_table"></a> [manage\_default\_route\_table](#input\_manage\_default\_route\_table)| Should be true to manage default route table |`bool`|`true`| no |
@@ -521,7 +528,7 @@ No modules.
521
528
| <aname="input_outpost_subnet_names"></a> [outpost\_subnet\_names](#input\_outpost\_subnet\_names)| Explicit values to use in the Name tag on outpost subnets. If empty, Name tags are generated |`list(string)`|`[]`| no |
522
529
| <aname="input_outpost_subnet_private_dns_hostname_type_on_launch"></a> [outpost\_subnet\_private\_dns\_hostname\_type\_on\_launch](#input\_outpost\_subnet\_private\_dns\_hostname\_type\_on\_launch)| The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name`|`string`|`null`| no |
523
530
| <aname="input_outpost_subnet_suffix"></a> [outpost\_subnet\_suffix](#input\_outpost\_subnet\_suffix)| Suffix to append to outpost subnets name |`string`|`"outpost"`| no |
524
-
| <aname="input_outpost_subnet_tags"></a> [outpost\_subnet\_tags](#input\_outpost\_subnet\_tags)| Additional tags for the outpost subnets |`map(string)`|`{}`| no |
531
+
| <aname="input_outpost\_subnet\_tags"></a> [outpost\_subnet\_tags](#input\_outpost\_subnet\_tags)| Additional tags for the outpost subnets |`map(string)`|`{}`| no |
525
532
| <aname="input_outpost_subnets"></a> [outpost\_subnets](#input\_outpost\_subnets)| A list of outpost subnets inside the VPC |`list(string)`|`[]`| no |
526
533
| <aname="input_private_acl_tags"></a> [private\_acl\_tags](#input\_private\_acl\_tags)| Additional tags for the private subnets network ACL |`map(string)`|`{}`| no |
527
534
| <aname="input_private_dedicated_network_acl"></a> [private\_dedicated\_network\_acl](#input\_private\_dedicated\_network\_acl)| Whether to use dedicated network ACL (not default) and custom rules for private subnets |`bool`|`false`| no |
@@ -537,7 +544,7 @@ No modules.
537
544
| <aname="input_private_subnet_names"></a> [private\_subnet\_names](#input\_private\_subnet\_names)| Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated |`list(string)`|`[]`| no |
538
545
| <aname="input_private_subnet_private_dns_hostname_type_on_launch"></a> [private\_subnet\_private\_dns\_hostname\_type\_on\_launch](#input\_private\_subnet\_private\_dns\_hostname\_type\_on\_launch)| The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name`|`string`|`null`| no |
539
546
| <aname="input_private_subnet_suffix"></a> [private\_subnet\_suffix](#input\_private\_subnet\_suffix)| Suffix to append to private subnets name |`string`|`"private"`| no |
540
-
| <aname="input_private_subnet_tags"></a> [private\_subnet\_tags](#input\_private\_subnet\_tags)| Additional tags for the private subnets |`map(string)`|`{}`| no |
547
+
| <aname="input_private\_subnet\_tags"></a> [private\_subnet\_tags](#input\_private\_subnet\_tags)| Additional tags for the private subnets |`map(string)`|`{}`| no |
541
548
| <aname="input_private_subnet_tags_per_az"></a> [private\_subnet\_tags\_per\_az](#input\_private\_subnet\_tags\_per\_az)| Additional tags for the private subnets where the primary key is the AZ |`map(map(string))`|`{}`| no |
542
549
| <aname="input_private_subnets"></a> [private\_subnets](#input\_private\_subnets)| A list of private subnets inside the VPC |`list(string)`|`[]`| no |
543
550
| <aname="input_propagate_intra_route_tables_vgw"></a> [propagate\_intra\_route\_tables\_vgw](#input\_propagate\_intra\_route\_tables\_vgw)| Should be true if you want route table propagation |`bool`|`false`| no |
@@ -557,7 +564,7 @@ No modules.
557
564
| <aname="input_public_subnet_names"></a> [public\_subnet\_names](#input\_public\_subnet\_names)| Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated |`list(string)`|`[]`| no |
558
565
| <aname="input_public_subnet_private_dns_hostname_type_on_launch"></a> [public\_subnet\_private\_dns\_hostname\_type\_on\_launch](#input\_public\_subnet\_private\_dns\_hostname\_type\_on\_launch)| The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name`|`string`|`null`| no |
559
566
| <aname="input_public_subnet_suffix"></a> [public\_subnet\_suffix](#input\_public\_subnet\_suffix)| Suffix to append to public subnets name |`string`|`"public"`| no |
560
-
| <aname="input_public_subnet_tags"></a> [public\_subnet\_tags](#input\_public\_subnet\_tags)| Additional tags for the public subnets |`map(string)`|`{}`| no |
567
+
| <aname="input_public\_subnet\_tags"></a> [public\_subnet\_tags](#input\_public\_subnet\_tags)| Additional tags for the public subnets |`map(string)`|`{}`| no |
561
568
| <aname="input_public_subnet_tags_per_az"></a> [public\_subnet\_tags\_per\_az](#input\_public\_subnet\_tags\_per\_az)| Additional tags for the public subnets where the primary key is the AZ |`map(map(string))`|`{}`| no |
562
569
| <aname="input_public_subnets"></a> [public\_subnets](#input\_public\_subnets)| A list of public subnets inside the VPC |`list(string)`|`[]`| no |
563
570
| <aname="input_putin_khuylo"></a> [putin\_khuylo](#input\_putin\_khuylo)| Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!|`bool`|`true`| no |
@@ -571,13 +578,13 @@ No modules.
571
578
| <aname="input_redshift_subnet_enable_resource_name_dns_a_record_on_launch"></a> [redshift\_subnet\_enable\_resource\_name\_dns\_a\_record\_on\_launch](#input\_redshift\_subnet\_enable\_resource\_name\_dns\_a\_record\_on\_launch)| Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false`|`bool`|`false`| no |
572
579
| <aname="input_redshift_subnet_enable_resource_name_dns_aaaa_record_on_launch"></a> [redshift\_subnet\_enable\_resource\_name\_dns\_aaaa\_record\_on\_launch](#input\_redshift\_subnet\_enable\_resource\_name\_dns\_aaaa\_record\_on\_launch)| Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records. Default: `true`|`bool`|`true`| no |
573
580
| <aname="input_redshift_subnet_group_name"></a> [redshift\_subnet\_group\_name](#input\_redshift\_subnet\_group\_name)| Name of redshift subnet group |`string`|`null`| no |
574
-
| <aname="input_redshift_subnet_group_tags"></a> [redshift\_subnet\_group\_tags](#input\_redshift\_subnet\_group\_tags)| Additional tags for the redshift subnet group |`map(string)`|`{}`| no |
581
+
| <aname="input_redshift\_subnet\_group\_tags"></a> [redshift\_subnet\_group\_tags](#input\_redshift\_subnet\_group\_tags)| Additional tags for the redshift subnet group |`map(string)`|`{}`| no |
575
582
| <aname="input_redshift_subnet_ipv6_native"></a> [redshift\_subnet\_ipv6\_native](#input\_redshift\_subnet\_ipv6\_native)| Indicates whether to create an IPv6-only subnet. Default: `false`|`bool`|`false`| no |
576
583
| <aname="input_redshift_subnet_ipv6_prefixes"></a> [redshift\_subnet\_ipv6\_prefixes](#input\_redshift\_subnet\_ipv6\_prefixes)| Assigns IPv6 redshift subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list |`list(string)`|`[]`| no |
577
584
| <aname="input_redshift_subnet_names"></a> [redshift\_subnet\_names](#input\_redshift\_subnet\_names)| Explicit values to use in the Name tag on redshift subnets. If empty, Name tags are generated |`list(string)`|`[]`| no |
578
585
| <aname="input_redshift_subnet_private_dns_hostname_type_on_launch"></a> [redshift\_subnet\_private\_dns\_hostname\_type\_on\_launch](#input\_redshift\_subnet\_private\_dns\_hostname\_type\_on\_launch)| The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name`|`string`|`null`| no |
579
586
| <aname="input_redshift_subnet_suffix"></a> [redshift\_subnet\_suffix](#input\_redshift\_subnet\_suffix)| Suffix to append to redshift subnets name |`string`|`"redshift"`| no |
580
-
| <aname="input_redshift_subnet_tags"></a> [redshift\_subnet\_tags](#input\_redshift\_subnet\_tags)| Additional tags for the redshift subnets |`map(string)`|`{}`| no |
587
+
| <aname="input_redshift\_subnet\_tags"></a> [redshift\_subnet\_tags](#input\_redshift\_subnet\_tags)| Additional tags for the redshift subnets |`map(string)`|`{}`| no |
581
588
| <aname="input_redshift_subnets"></a> [redshift\_subnets](#input\_redshift\_subnets)| A list of redshift subnets inside the VPC |`list(string)`|`[]`| no |
582
589
| <aname="input_reuse_nat_ips"></a> [reuse\_nat\_ips](#input\_reuse\_nat\_ips)| Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external\_nat\_ip\_ids' variable |`bool`|`false`| no |
583
590
| <aname="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 |
@@ -695,8 +702,8 @@ No modules.
695
702
| <aname="output_redshift_route_table_association_ids"></a> [redshift\_route\_table\_association\_ids](#output\_redshift\_route\_table\_association\_ids)| List of IDs of the redshift route table association |
696
703
| <aname="output_redshift_route_table_ids"></a> [redshift\_route\_table\_ids](#output\_redshift\_route\_table\_ids)| List of IDs of redshift route tables |
697
704
| <aname="output_redshift_subnet_arns"></a> [redshift\_subnet\_arns](#output\_redshift\_subnet\_arns)| List of ARNs of redshift subnets |
698
-
| <aname="output_redshift_subnet_group"></a> [redshift\_subnet\_group](#output\_redshift\_subnet\_group)| ID of redshift subnet group |
699
-
| <aname="output_redshift_subnet_objects"></a> [redshift\_subnet\_objects](#output\_redshift\_subnet\_objects)| A list of all redshift subnets, containing the full objects. |
705
+
| <aname="output_redshift\_subnet\_group"></a> [redshift\_subnet\_group](#output\_redshift\_subnet\_group)| ID of redshift subnet group |
706
+
| <aname="output_redshift\_subnet\_objects"></a> [redshift\_subnet\_objects](#output\_redshift\_subnet\_objects)| A list of all redshift subnets, containing the full objects. |
700
707
| <aname="output_redshift_subnets"></a> [redshift\_subnets](#output\_redshift\_subnets)| List of IDs of redshift subnets |
701
708
| <aname="output_redshift_subnets_cidr_blocks"></a> [redshift\_subnets\_cidr\_blocks](#output\_redshift\_subnets\_cidr\_blocks)| List of cidr\_blocks of redshift subnets |
702
709
| <aname="output_redshift_subnets_ipv6_cidr_blocks"></a> [redshift\_subnets\_ipv6\_cidr\_blocks](#output\_redshift\_subnets\_ipv6\_cidr\_blocks)| List of IPv6 cidr\_blocks of redshift subnets in an IPv6 enabled VPC |
0 commit comments