-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsecurity_groups.tf
More file actions
111 lines (93 loc) · 2.91 KB
/
security_groups.tf
File metadata and controls
111 lines (93 loc) · 2.91 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
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
102
103
104
105
106
107
108
109
110
111
#
# RDS Security Group
#
resource "aws_security_group" "security_monkey_rds_security_group" {
name = "${data.template_file.name.rendered}-RDSSecurityGroup"
description = "Security Monkey RDS"
vpc_id = "${var.vpc_id}"
ingress {
from_port = 5432
to_port = 5432
protocol = "TCP"
security_groups = ["${aws_security_group.security_monkey_instance_security_group.id}", "${aws_security_group.security_monkey_worker_scheduler_security_group.id}"]
}
tags = "${merge(map("Name", "${data.template_file.name.rendered}-rds-sg"), var.extra_tags)}"
}
#
# Instance Security Group
#
resource "aws_security_group" "security_monkey_instance_security_group" {
name = "${data.template_file.name.rendered}-InstanceSecurityGroup"
description = "Security Monkey Instances"
vpc_id = "${var.vpc_id}"
ingress {
from_port = 443
to_port = 443
protocol = "TCP"
security_groups = ["${aws_security_group.security_monkey_alb_security_group.id}"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = "${merge(map("Name", "${data.template_file.name.rendered}-ec2-sg"), var.extra_tags)}"
}
#
# Worker and Scheduler Security Group
#
resource "aws_security_group" "security_monkey_worker_scheduler_security_group" {
name = "${data.template_file.name.rendered}-WorkSchedSecurityGroup"
description = "Security Monkey Worker&Scheduler"
vpc_id = "${var.vpc_id}"
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = "${merge(map("Name", "${data.template_file.name.rendered}-work-sched-sg"), var.extra_tags)}"
}
#
# ALB Security Group
#
resource "aws_security_group" "security_monkey_alb_security_group" {
name = "${data.template_file.name.rendered}-ALBSecurityGroup"
description = "Security Monkey ALB"
vpc_id = "${var.vpc_id}"
ingress {
from_port = 443
to_port = 443
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 = "${merge(map("Name", "${data.template_file.name.rendered}-alb-sg"), var.extra_tags)}"
}
#
# ElastiCache Security Group
#
resource "aws_security_group" "security_monkey_elasticache_security_group" {
name = "${data.template_file.name.rendered}-ElastiCacheSecurityGroup"
description = "Security Monkey ElastiCache"
vpc_id = "${var.vpc_id}"
ingress {
from_port = 6379
to_port = 6379
protocol = "tcp"
security_groups = ["${aws_security_group.security_monkey_instance_security_group.id}", "${aws_security_group.security_monkey_worker_scheduler_security_group.id}"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = "${merge(map("Name", "${data.template_file.name.rendered}-elasticache-sg"), var.extra_tags)}"
}