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
* Initial commit for issue #117
* Adding documentation for NAT Gateway creation
* Adding `enable_nat_gateway` to the documentation
* Updating README.md with `one_nat_gateway_per_az` to be 'true' by default
* Reverted changes back to `one_nat_gateway_per_az` as 'false'
Copy file name to clipboardExpand all lines: README.md
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,49 @@ Note that in the example we allocate 3 IPs because we will be provisioning 3 NAT
78
78
If, on the other hand, `single_nat_gateway = true`, then `aws_eip.nat` would only need to allocate 1 IP.
79
79
Passing the IPs into the module is done by setting two variables `reuse_nat_ips = true` and `external_nat_ip_ids = ["${aws_eip.nat.*.id}"]`.
80
80
81
+
## NAT Gateway Scenarios
82
+
83
+
This module supports three scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.
84
+
85
+
* One NAT Gateway per subnet (default behavior)
86
+
*`enable_nat_gateway = true`
87
+
*`single_nat_gateway = false`
88
+
*`one_nat_gateway_per_az = false`
89
+
* Single NAT Gateway
90
+
*`enable_nat_gateway = true`
91
+
*`single_nat_gateway = true`
92
+
*`one_nat_gateway_per_az = false`
93
+
* One NAT Gateway per availability zone
94
+
*`enable_nat_gateway = true`
95
+
*`single_nat_gateway = false`
96
+
*`one_nat_gateway_per_az = true`
97
+
98
+
If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence.
99
+
100
+
### One NAT Gateway per subnet (default)
101
+
102
+
By default, the module will determine the number of NAT Gateways to create based on the the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). For example, if your configuration looks like the following:
Then `5` NAT Gateways will be created since `5` private subnet CIDR blocks were specified.
112
+
113
+
### Single NAT Gateway
114
+
115
+
If `single_nat_gateway = true`, then all private subnets will route their Internet traffic through this single NAT gateway. The NAT gateway will be placed in the first public subnet in your `public_subnets` block.
116
+
117
+
### One NAT Gateway per availability zone
118
+
119
+
If `one_nat_gateway_per_az = true` and `single_nat_gateway = false`, then the module will place one NAT gateway in each availability zone you specify in `var.azs`. There are some requirements around using this feature flag:
120
+
121
+
* The variable `var.azs`**must** be specified.
122
+
* The number of public subnet CIDR blocks specified in `public_subnets`**must** be greater than or equal to the number of availability zones specified in `var.azs`. This is to ensure that each NAT Gateway has a dedicated public subnet to deploy to.
123
+
81
124
## Conditional creation
82
125
83
126
Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.
@@ -141,6 +184,7 @@ Terraform version 0.10.3 or newer is required for this module to work.
141
184
| manage_default_vpc | Should be true to adopt and manage Default VPC | string |`false`| no |
142
185
| map_public_ip_on_launch | Should be false if you do not want to auto-assign public IP on launch | string |`true`| no |
143
186
| name | Name to be used on all the resources as identifier | string | `` | no |
187
+
| one_nat_gateway_per_az | Should be true if you want only one NAT Gateway per availability zone. Requires the input `azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `azs`. | string |`false`| no |
144
188
| private_route_table_tags | Additional tags for the private route tables | string |`<map>`| no |
145
189
| private_subnet_tags | Additional tags for the private subnets | string |`<map>`| no |
146
190
| private_subnets | A list of private subnets inside the VPC | string |`<list>`| no |
@@ -227,3 +271,4 @@ Module managed by [Anton Babenko](https://github.com/antonbabenko).
description="Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`."
81
+
default=false
82
+
}
83
+
79
84
variable"reuse_nat_ips" {
80
85
description="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"
0 commit comments