Skip to content

Commit

Permalink
chore(nat-gateway): Add nat_gateway_tags_per_az variable for NAT gate…
Browse files Browse the repository at this point in the history
…ways
  • Loading branch information
pavlospt committed Nov 19, 2024
1 parent 9ffd9c6 commit cba7cea
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ No modules.
| <a name="input_nat_eip_tags"></a> [nat\_eip\_tags](#input\_nat\_eip\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |
| <a name="input_nat_gateway_destination_cidr_block"></a> [nat\_gateway\_destination\_cidr\_block](#input\_nat\_gateway\_destination\_cidr\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `"0.0.0.0/0"` | no |
| <a name="input_nat_gateway_tags"></a> [nat\_gateway\_tags](#input\_nat\_gateway\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |
| <a name="input_nat_gateway_tags_per_az"></a> [nat\_gateway\_tags\_per\_az](#input\_nat\_gateway\_tags\_per\_az) | Additional tags for the NAT gateways where the primary key is the AZ | `map(map(string))` | `{}` | no |
| <a name="input_one_nat_gateway_per_az"></a> [one\_nat\_gateway\_per\_az](#input\_one\_nat\_gateway\_per\_az) | 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` | `bool` | `false` | no |
| <a name="input_outpost_acl_tags"></a> [outpost\_acl\_tags](#input\_outpost\_acl\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |
| <a name="input_outpost_arn"></a> [outpost\_arn](#input\_outpost\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |
Expand Down
6 changes: 6 additions & 0 deletions examples/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@ module "vpc" {
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]

tags = local.tags

nat_gateway_tags_per_az = {
for az in local.azs : az => {
Name = "NAT Gateway - ${az}"
}
}
}
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ resource "aws_nat_gateway" "this" {
},
var.tags,
var.nat_gateway_tags,
lookup(var.nat_gateway_tags_per_az, element(var.azs, count.index), {})
)

depends_on = [aws_internet_gateway.this]
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,12 @@ variable "nat_gateway_tags" {
default = {}
}

variable "nat_gateway_tags_per_az" {
description = "Additional tags for the NAT gateways where the primary key is the AZ"
type = map(map(string))
default = {}
}

variable "nat_eip_tags" {
description = "Additional tags for the NAT EIP"
type = map(string)
Expand Down

0 comments on commit cba7cea

Please sign in to comment.