-
Notifications
You must be signed in to change notification settings - Fork 15
/
nat.tf
28 lines (22 loc) · 845 Bytes
/
nat.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
resource "aws_eip" "nat" {
count = local.include_nat_gateways == "yes" ? length(var.availability_zones) : 0
vpc = true
tags = {
Name = "eip-nat-${var.component}-${var.deployment_identifier}-${element(var.availability_zones, count.index)}"
Component = var.component
DeploymentIdentifier = var.deployment_identifier
}
}
resource "aws_nat_gateway" "base" {
count = local.include_nat_gateways == "yes" ? length(var.availability_zones) : 0
allocation_id = element(aws_eip.nat.*.id, count.index)
subnet_id = element(aws_subnet.public.*.id, count.index)
depends_on = [
aws_internet_gateway.base_igw
]
tags = {
Name = "nat-${var.component}-${var.deployment_identifier}-${element(var.availability_zones, count.index)}"
Component = var.component
DeploymentIdentifier = var.deployment_identifier
}
}