-
Notifications
You must be signed in to change notification settings - Fork 9
/
security_group.tf
50 lines (45 loc) · 1.06 KB
/
security_group.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
resource "aws_security_group" "nat" {
name_prefix = "NatAz${title(substr(local.az, -1, -1))}"
description = "Rules for Nat instance"
vpc_id = local.vpc_id
tags = local.tags
dynamic "ingress" {
for_each = local.ports.tcp
content {
cidr_blocks = local.client_subnet_cidrs
from_port = ingress.value
protocol = "tcp"
to_port = ingress.value
}
}
dynamic "egress" {
for_each = local.ports.tcp
content {
cidr_blocks = ["0.0.0.0/0"]
from_port = egress.value
protocol = "tcp"
to_port = egress.value
}
}
dynamic "ingress" {
for_each = local.ports.udp
content {
cidr_blocks = local.client_subnet_cidrs
from_port = ingress.value
protocol = "udp"
to_port = ingress.value
}
}
dynamic "egress" {
for_each = local.ports.udp
content {
cidr_blocks = ["0.0.0.0/0"]
from_port = egress.value
protocol = "udp"
to_port = egress.value
}
}
lifecycle {
create_before_destroy = true
}
}