Skip to content

Commit 058dbba

Browse files
committed
chore(nat-gateway): Add nat_gateway_tags_per_az variable for NAT gateways
1 parent 9ffd9c6 commit 058dbba

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

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
@@ -1096,6 +1096,7 @@ resource "aws_nat_gateway" "this" {
10961096
},
10971097
var.tags,
10981098
var.nat_gateway_tags,
1099+
lookup(var.nat_gateway_tags_per_az, element(var.azs, count.index), {})
10991100
)
11001101

11011102
depends_on = [aws_internet_gateway.this]

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,12 @@ variable "nat_gateway_tags" {
12401240
default = {}
12411241
}
12421242

1243+
variable "nat_gateway_tags_per_az" {
1244+
description = "Additional tags for the NAT gateways where the primary key is the AZ"
1245+
type = map(map(string))
1246+
default = {}
1247+
}
1248+
12431249
variable "nat_eip_tags" {
12441250
description = "Additional tags for the NAT EIP"
12451251
type = map(string)

0 commit comments

Comments
 (0)