-
Notifications
You must be signed in to change notification settings - Fork 0
/
security-groups.tf
101 lines (69 loc) · 2.3 KB
/
security-groups.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
resource "aws_security_group" "runner" {
name = "Gitlab-Runner SG"
description = "SG for Gitlab Runner"
vpc_id = aws_vpc.vpc.id
}
resource "aws_security_group" "dagger" {
name = "Dagger Host SG"
description = "SG for Dagger Host"
vpc_id = aws_vpc.vpc.id
}
resource "aws_vpc_security_group_ingress_rule" "dagger_tcp" {
description = "Allow TCP traffic from the Gitlab Runner instance"
security_group_id = aws_security_group.dagger.id
ip_protocol = "tcp"
from_port = var.dagger_engine_port
to_port = var.dagger_engine_port
referenced_security_group_id = aws_security_group.runner.id
tags = {
Name = "TCP from Gitlab Runner"
}
}
resource "aws_vpc_security_group_egress_rule" "gitlab_all_out_443" {
description = "Allow port 443 outbound from Gitlab"
security_group_id = aws_security_group.runner.id
ip_protocol = "tcp"
from_port = 443
to_port = 443
cidr_ipv4 = "0.0.0.0/0"
}
resource "aws_vpc_security_group_egress_rule" "gitlab_all_out_80" {
description = "Allow port 80 outbound from Gitlab"
security_group_id = aws_security_group.runner.id
ip_protocol = "tcp"
from_port = 80
to_port = 80
cidr_ipv4 = "0.0.0.0/0"
}
resource "aws_vpc_security_group_egress_rule" "gitlab_to_dagger_out" {
description = "Allow Gitlab to talk to Dagger"
security_group_id = aws_security_group.runner.id
ip_protocol = "tcp"
from_port = var.dagger_engine_port
to_port = var.dagger_engine_port
referenced_security_group_id = aws_security_group.dagger.id
}
resource "aws_vpc_security_group_egress_rule" "dagger_all_out_443" {
description = "Allow port 443 outbound from Dagger"
security_group_id = aws_security_group.dagger.id
ip_protocol = "tcp"
from_port = 443
to_port = 443
cidr_ipv4 = "0.0.0.0/0"
}
resource "aws_vpc_security_group_egress_rule" "dagger_all_out_80" {
description = "Allow port 80 outbound from Dagger"
security_group_id = aws_security_group.dagger.id
ip_protocol = "tcp"
from_port = 80
to_port = 80
cidr_ipv4 = "0.0.0.0/0"
}
resource "aws_vpc_security_group_egress_rule" "dagger_all_out_22" {
description = "Allow port 22 outbound from Dagger"
security_group_id = aws_security_group.dagger.id
ip_protocol = "tcp"
from_port = 22
to_port = 22
cidr_ipv4 = "0.0.0.0/0"
}