Skip to content

Commit 1f18f74

Browse files
committed
chore(nat-gateway): Add nat_gateway_tags_per_az variable for NAT gateways
1 parent e31b161 commit 1f18f74

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ No modules.
505505
| <a name="input_nat_eip_tags"></a> [nat\_eip\_tags](#input\_nat\_eip\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |
506506
| <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 |
507507
| <a name="input_nat_gateway_tags"></a> [nat\_gateway\_tags](#input\_nat\_gateway\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |
508+
| <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 |
508509
| <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 |
509510
| <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 |
510511
| <a name="input_outpost_arn"></a> [outpost\_arn](#input\_outpost\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |

examples/simple/main.tf

+6
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,10 @@ module "vpc" {
3232
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]
3333

3434
tags = local.tags
35+
36+
nat_gateway_tags_per_az = {
37+
for az in local.azs : az => {
38+
Name = "NAT Gateway - ${az}"
39+
}
40+
}
3541
}

main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,7 @@ resource "aws_nat_gateway" "this" {
11261126
},
11271127
var.tags,
11281128
var.nat_gateway_tags,
1129+
lookup(var.nat_gateway_tags_per_az, element(var.azs, count.index), {})
11291130
)
11301131

11311132
depends_on = [aws_internet_gateway.this]

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,12 @@ variable "nat_gateway_tags" {
12521252
default = {}
12531253
}
12541254

1255+
variable "nat_gateway_tags_per_az" {
1256+
description = "Additional tags for the NAT gateways where the primary key is the AZ"
1257+
type = map(map(string))
1258+
default = {}
1259+
}
1260+
12551261
variable "nat_eip_tags" {
12561262
description = "Additional tags for the NAT EIP"
12571263
type = map(string)

0 commit comments

Comments
 (0)