-
Notifications
You must be signed in to change notification settings - Fork 8
/
security.tf
75 lines (66 loc) · 2.6 KB
/
security.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
resource "aws_security_group" "service" {
name = "${var.namespace}.service"
description = "common security group for all services in the internal subnet"
vpc_id = "${aws_vpc.default.id}"
tags {
Name = "${format("%s-service", var.namespace)}"
}
}
resource "aws_security_group_rule" "service_ingress_bastion" {
type = "ingress"
security_group_id = "${aws_security_group.service.id}"
source_security_group_id = "${aws_security_group.bastion.id}"
from_port = 22
to_port = 22
protocol = "tcp"
count = "${var.debug}"
}
resource "aws_security_group_rule" "service_ingress_functions_from_bastion" {
type = "ingress"
security_group_id = "${aws_security_group.service.id}"
source_security_group_id = "${aws_security_group.bastion.id}"
from_port = 8080
to_port = 8080
protocol = "tcp"
count = "${var.debug}"
}
resource "aws_security_group_rule" "service_ingress_functions_from_provider" {
type = "ingress"
security_group_id = "${aws_security_group.service.id}"
source_security_group_id = "${aws_security_group.gateway.id}"
from_port = 8080
to_port = 8080
protocol = "tcp"
}
resource "aws_security_group_rule" "service_ingress_functions_service" {
type = "ingress"
security_group_id = "${aws_security_group.service.id}"
self = true
from_port = 8080
to_port = 8080
protocol = "tcp"
}
resource "aws_security_group_rule" "service_egress_functions_service" {
type = "egress"
security_group_id = "${aws_security_group.service.id}"
self = true
from_port = 8080
to_port = 8080
protocol = "tcp"
}
resource "aws_security_group_rule" "service_egress_http" {
type = "egress"
security_group_id = "${aws_security_group.service.id}"
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
resource "aws_security_group_rule" "service_egress_https" {
type = "egress"
security_group_id = "${aws_security_group.service.id}"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}