-
Notifications
You must be signed in to change notification settings - Fork 5
/
security_group_nodes.tf
66 lines (60 loc) · 2.19 KB
/
security_group_nodes.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
resource "aws_security_group" "nodes" {
name = "${module.label.id}-nodes"
description = "Security group for RKE nodes"
vpc_id = var.vpc_id
tags = module.label.tags
}
resource "aws_security_group_rule" "nodes_egress" {
description = "Allow all egress traffic"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"] #tfsec:ignore:AWS007
security_group_id = aws_security_group.nodes.id
type = "egress"
}
resource "aws_security_group_rule" "nodes_ingress_self" {
description = "Allow all intra-security-group traffic"
from_port = 0
to_port = 0
protocol = "-1"
self = true
security_group_id = aws_security_group.nodes.id
type = "ingress"
}
resource "aws_security_group_rule" "nodes_ingress_ssh" {
description = "Allow all SSH traffic"
from_port = 22
to_port = 22
protocol = "TCP"
cidr_blocks = ["0.0.0.0/0"] #tfsec:ignore:AWS006
security_group_id = aws_security_group.nodes.id
type = "ingress"
}
resource "aws_security_group_rule" "nodes_ingress_k8s" {
description = "Allow all k8s API traffic"
from_port = 6443
to_port = 6443
protocol = "TCP"
cidr_blocks = ["0.0.0.0/0"] #tfsec:ignore:AWS006
security_group_id = aws_security_group.nodes.id
type = "ingress"
}
resource "aws_security_group_rule" "nodes_ingress_elb_80" {
description = "Allow HTTP traffic from the ELB"
from_port = 80
to_port = 80
protocol = "TCP"
source_security_group_id = aws_security_group.ingress_elb.id
security_group_id = aws_security_group.nodes.id
type = "ingress"
}
resource "aws_security_group_rule" "nodes_ingress_elb_443" {
description = "Allow HTTPS traffic from the ELB"
from_port = 443
to_port = 443
protocol = "TCP"
source_security_group_id = aws_security_group.ingress_elb.id
security_group_id = aws_security_group.nodes.id
type = "ingress"
}