-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsg_worker.tf
More file actions
49 lines (37 loc) · 1.16 KB
/
sg_worker.tf
File metadata and controls
49 lines (37 loc) · 1.16 KB
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
resource "aws_security_group" "worker" {
name = "boundary-worker"
description = "Boundary worker rules"
vpc_id = var.vpc_id
tags = {
"resinstack:cluster" = var.cluster_tag
}
}
resource "aws_security_group_rule" "permit_control_to_controllers" {
description = "Permit worker-controller control traffic"
security_group_id = aws_security_group.worker.id
type = "egress"
from_port = 9201
to_port = 9201
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
resource "aws_security_group_rule" "permit_worker_to_targets" {
for_each = var.target_sgs
description = "Permit workers to targets ${each.key}"
security_group_id = aws_security_group.worker.id
type = "egress"
from_port = each.value.port
to_port = each.value.port
protocol = "tcp"
source_security_group_id = each.value.group
}
resource "aws_security_group_rule" "accept_proxy_from_sources" {
for_each = var.client_sgs
description = "Accept proxy traffic from ${each.key}"
security_group_id = aws_security_group.worker.id
type = "ingress"
from_port = 9202
to_port = 9202
protocol = "tcp"
cidr_blocks = each.value
}