From f28da8a37822c9f27efe71c215f7a324c9f81fb1 Mon Sep 17 00:00:00 2001 From: Nuru Date: Sun, 13 Oct 2024 09:46:34 -0700 Subject: [PATCH] [vpc] Add `max_nats` configuration (#1158) --- modules/vpc/README.md | 1 + modules/vpc/main.tf | 1 + modules/vpc/variables.tf | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/modules/vpc/README.md b/modules/vpc/README.md index cc9d93b7a..c14ee78f0 100644 --- a/modules/vpc/README.md +++ b/modules/vpc/README.md @@ -125,6 +125,7 @@ components: | [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,
set as tag values, and output by this module individually.
Does not affect values of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.
Default value: `lower`. | `string` | `null` | no | | [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.
Default is to include all labels.
Tags with empty values will not be included in the `tags` output.
Set to `[]` to suppress all generated tags.
**Notes:**
The value of the `name` tag, if included, will be the `id`, not the `name`.
Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be
changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` |
[
"default"
]
| no | | [map\_public\_ip\_on\_launch](#input\_map\_public\_ip\_on\_launch) | Instances launched into a public subnet should be assigned a public IP address | `bool` | `true` | no | +| [max\_nats](#input\_max\_nats) | Upper limit on number of NAT Gateways/Instances to create.
Set to 1 or 2 for cost savings at the expense of availability.
Default creates a NAT Gateway in each public subnet. | `number` | `null` | no | | [max\_subnet\_count](#input\_max\_subnet\_count) | Sets the maximum amount of subnets to deploy. 0 will deploy a subnet for every provided availability zone (in `region_availability_zones` variable) within the region | `number` | `0` | no | | [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no | | [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no | diff --git a/modules/vpc/main.tf b/modules/vpc/main.tf index ea9e41735..9ea6b0542 100644 --- a/modules/vpc/main.tf +++ b/modules/vpc/main.tf @@ -149,6 +149,7 @@ module "subnets" { 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 + max_nats = var.max_nats nat_gateway_enabled = var.nat_gateway_enabled nat_instance_enabled = var.nat_instance_enabled nat_instance_type = var.nat_instance_type diff --git a/modules/vpc/variables.tf b/modules/vpc/variables.tf index 6e9940acb..e437085d7 100644 --- a/modules/vpc/variables.tf +++ b/modules/vpc/variables.tf @@ -104,6 +104,16 @@ variable "public_subnets_enabled" { default = true } +variable "max_nats" { + type = number + description = <<-EOT + Upper limit on number of NAT Gateways/Instances to create. + Set to 1 or 2 for cost savings at the expense of availability. + Default creates a NAT Gateway in each public subnet. + EOT + default = null +} + variable "nat_gateway_enabled" { type = bool description = "Flag to enable/disable NAT gateways"