-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheip-sg.tf
25 lines (22 loc) · 967 Bytes
/
eip-sg.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
resource "aws_security_group_rule" "eip_access_tcp" {
count = var.lb_type == "EIP" ? length(var.tcp_ports) : 0
description = "TCP/${var.tcp_ports[count.index]} access"
type = "ingress"
from_port = var.tcp_ports[count.index]
to_port = var.tcp_ports[count.index]
protocol = "TCP"
security_group_id = aws_security_group.default.id
cidr_blocks = var.sg_cidr_blocks
depends_on = [aws_security_group.default]
}
resource "aws_security_group_rule" "eip_access_udp" {
count = var.lb_type == "EIP" ? length(var.udp_ports) : 0
description = "UDP/${var.udp_ports[count.index]} access"
type = "ingress"
from_port = var.udp_ports[count.index]
to_port = var.udp_ports[count.index]
protocol = "UDP"
security_group_id = aws_security_group.default.id
cidr_blocks = var.sg_cidr_blocks
depends_on = [aws_security_group.default]
}