-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode_security_group.tf
More file actions
101 lines (91 loc) · 3.27 KB
/
node_security_group.tf
File metadata and controls
101 lines (91 loc) · 3.27 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
// See https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html
resource "aws_security_group" "node" {
vpc_id = local.vpc_id
name = "${local.resource_name} Node"
description = "Security Group for EKS Nodes"
tags = merge(local.tags, {
Name = "${local.resource_name}-node"
"kubernetes.io/cluster/${local.resource_name}" = "owned"
})
}
resource "aws_security_group_rule" "node-dns-tcp-from-self" {
description = "Allow nodes to access other node nameservers over TCP"
security_group_id = aws_security_group.node.id
type = "ingress"
protocol = "tcp"
from_port = 53
to_port = 53
self = true
}
resource "aws_security_group_rule" "node-dns-udp-from-self" {
description = "Allow nodes to access other node nameservers over UDP"
security_group_id = aws_security_group.node.id
type = "ingress"
protocol = "udp"
from_port = 53
to_port = 53
self = true
}
resource "aws_security_group_rule" "node-dns-tcp-to-self" {
description = "Allow nodes to reach other node nameservers over TCP"
security_group_id = aws_security_group.node.id
type = "egress"
protocol = "tcp"
from_port = 53
to_port = 53
self = true
}
resource "aws_security_group_rule" "node-dns-udp-to-self" {
description = "Allow nodes to reach other node nameservers over UDP"
security_group_id = aws_security_group.node.id
type = "egress"
protocol = "udp"
from_port = 53
to_port = 53
self = true
}
resource "aws_security_group_rule" "node-10250-to-self" {
description = "Allow nodes to reach other nodes on 10250"
security_group_id = aws_security_group.node.id
type = "egress"
protocol = "tcp"
from_port = 10250
to_port = 10250
self = true
}
resource "aws_security_group_rule" "node-10250-from-self" {
description = "Allow nodes to access other nodes on 10250"
security_group_id = aws_security_group.node.id
type = "ingress"
protocol = "tcp"
from_port = 10250
to_port = 10250
self = true
}
resource "aws_security_group_rule" "node-https-to-self" {
description = "Allow nodes to reach other nodes over HTTPS"
security_group_id = aws_security_group.node.id
type = "egress"
protocol = "tcp"
from_port = 443
to_port = 443
self = true
}
resource "aws_security_group_rule" "node-https-from-self" {
description = "Allow nodes to access other nodes over HTTPS"
security_group_id = aws_security_group.node.id
type = "ingress"
protocol = "tcp"
from_port = 443
to_port = 443
self = true
}
resource "aws_security_group_rule" "node-to-world-ipv4" {
description = "Allow node to reach world for cluster introspection and node registration"
security_group_id = aws_security_group.node.id
type = "egress"
protocol = "tcp"
from_port = 0
to_port = 0
cidr_blocks = ["0.0.0.0/0"]
}