-
Notifications
You must be signed in to change notification settings - Fork 4
/
security-groups.tf
83 lines (72 loc) · 2.32 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
resource "aws_security_group" "sg_efs-nexus" {
name = "sg_efs-nexus-ingress"
description = "Permite o trafico do EC2 para o EFS"
vpc_id = "${var.vpc-id}"
tags {
Name = "sg_efs-nexus-ingress"
}
}
resource "aws_security_group_rule" "sgr_efs-nexus-ingress" {
type = "ingress"
from_port = 2049
to_port = 2049
protocol = "tcp"
security_group_id = "${aws_security_group.sg_efs-nexus.id}"
source_security_group_id = "${aws_security_group.sg-ec2_nexus.id}"
}
resource "aws_security_group" "sg-alb_nexus" {
name = "sg_alb_nexus"
description = "Permite o trafego para no ALB"
vpc_id = "${var.vpc-id}"
tags {
Name = "sg-alb_nexus"
}
}
resource "aws_security_group_rule" "sgr-alb_nexus-http" {
type = "ingress"
from_port = 80
to_port = 80
protocol = "tcp"
security_group_id = "${aws_security_group.sg-alb_nexus.id}"
cidr_blocks = ["0.0.0.0/0"]
}
resource "aws_security_group_rule" "sgr-alb_nexus-outgoing" {
type = "egress"
from_port = 0
to_port = 0
protocol = "-1"
security_group_id = "${aws_security_group.sg-alb_nexus.id}"
cidr_blocks = ["0.0.0.0/0"]
}
resource "aws_security_group" "sg-ec2_nexus" {
name = "sg_ec2_nexus"
description = "Permite o trafego para ao EC2"
vpc_id = "${var.vpc-id}"
tags {
Name = "sg-ec2_nexus"
}
}
resource "aws_security_group_rule" "sgr-ec2_nexus-ssh" {
type = "ingress"
from_port = 22
to_port = 22
protocol = "tcp"
security_group_id = "${aws_security_group.sg-ec2_nexus.id}"
cidr_blocks = ["0.0.0.0/0"]
}
resource "aws_security_group_rule" "sgr-ec2_nexus-http" {
type = "ingress"
from_port = 0
to_port = 0
protocol = "-1"
security_group_id = "${aws_security_group.sg-ec2_nexus.id}"
source_security_group_id = "${aws_security_group.sg-alb_nexus.id}"
}
resource "aws_security_group_rule" "srg-ec2_nexus-outgoing" {
type = "egress"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = "${aws_security_group.sg-ec2_nexus.id}"
}