-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathsecurity.tf
50 lines (43 loc) · 1.1 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
resource "aws_security_group" "self" {
name = "${local.cluster_id}-self"
vpc_id = data.aws_vpc.this.id
description = "Allow all members of this SG to inter-communicate"
ingress {
from_port = 0
to_port = 0
protocol = "-1"
self = true
}
tags = {
# required for load balancer, see:
# https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html
"kubernetes.io/cluster/${local.cluster_id}" = "owned"
}
lifecycle {
ignore_changes = [
tags
]
}
}
resource "aws_security_group" "node_ports" {
name = "${local.cluster_id}-node-ports"
vpc_id = data.aws_vpc.this.id
description = "Allow node ports to be discovered"
ingress {
from_port = 30000
to_port = 32767
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_security_group" "egress" {
name = "${local.cluster_id}-egress"
vpc_id = data.aws_vpc.this.id
description = "Allow unbounded egress communication"
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}