-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsg.tf
64 lines (54 loc) · 1.22 KB
/
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
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
# Security Groups
# Data
locals {
sg_name = "${format("%s_%s_%s", var.cluster_id, "ssh", "sg")}"
sg_all_name = "${format("%s_%s_%s", var.cluster_id, "all", "sg")}"
}
# Allow ssh
resource "aws_security_group" "allow_ssh" {
name = "${local.sg_name}"
description = "Allow SSH inbound connections"
vpc_id = "${aws_vpc.airgap_vpc.id}"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "${local.sg_name}"
}
}
# Allow ssh
resource "aws_security_group" "allow_all" {
name = "${local.sg_all_name}"
description = "Allow all connection inside cluster"
vpc_id = "${aws_vpc.airgap_vpc.id}"
ingress {
from_port = 22
to_port = 22
protocol = "TCP"
cidr_blocks = ["10.0.0.0/16"]
}
ingress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["10.0.2.0/24"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "${local.sg_all_name}"
}
}