From 86e845033dfc288364a64795b5145753f4dde95d 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 (https://github.com/cloudposse/terraform-aws-components/pull/1158) --- src/README.md | 1 + src/main.tf | 1 + src/variables.tf | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/src/README.md b/src/README.md index cc9d93b..c14ee78 100644 --- a/src/README.md +++ b/src/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/src/main.tf b/src/main.tf index ea9e417..9ea6b05 100644 --- a/src/main.tf +++ b/src/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/src/variables.tf b/src/variables.tf index 6e9940a..e437085 100644 --- a/src/variables.tf +++ b/src/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"