-
Notifications
You must be signed in to change notification settings - Fork 4
/
security-group.tf
35 lines (31 loc) · 1.05 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
resource "aws_security_group" "eb" {
count = var.create_security_group == true ? 1 : 0
name = var.security_group_name
description = var.security_group_description
vpc_id = var.vpc_id
tags = { Name = var.security_group_name }
dynamic "ingress" {
for_each = var.ingress_rules
content {
from_port = ingress.value.from_port
to_port = ingress.value.to_port
protocol = ingress.value.protocol
description = ingress.value.description
cidr_blocks = ingress.value.cidr_blocks
security_groups = ingress.value.security_groups
self = ingress.value.self
}
}
dynamic "egress" {
for_each = var.egress_rules
content {
from_port = egress.value.from_port
to_port = egress.value.to_port
protocol = egress.value.protocol
description = egress.value.description
cidr_blocks = egress.value.cidr_blocks
security_groups = egress.value.security_groups
self = egress.value.self
}
}
}