-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy patheks.tf
119 lines (93 loc) · 2.83 KB
/
eks.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
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
112
113
114
115
116
117
118
119
resource "aws_eks_cluster" "eks_cluster" {
name = var.cluster_name
version = var.k8s_version
role_arn = aws_iam_role.eks_cluster_role.arn
vpc_config {
subnet_ids = [
aws_subnet.private_subnet_1a.id,
aws_subnet.private_subnet_1b.id,
aws_subnet.private_subnet_1c.id
]
}
encryption_config {
provider {
key_arn = aws_kms_key.eks.arn
}
resources = ["secrets"]
}
enabled_cluster_log_types = [
"api", "audit", "authenticator", "controllerManager", "scheduler"
]
tags = {
"kubernetes.io/cluster/${var.cluster_name}" = "shared",
"karpenter.sh/discovery" = var.cluster_name
}
}
resource "aws_security_group_rule" "nodeport_eks" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 30000
to_port = 32768
description = "nodeport"
protocol = "tcp"
security_group_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
type = "ingress"
}
resource "aws_security_group_rule" "nodeport_eks_udp" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 30000
to_port = 32768
description = "nodeport"
protocol = "udp"
security_group_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
type = "ingress"
}
resource "aws_security_group_rule" "rule_443" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 443
to_port = 443
description = ""
protocol = "tcp"
security_group_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
type = "ingress"
}
resource "aws_security_group_rule" "rule_80" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 80
to_port = 80
description = ""
protocol = "tcp"
security_group_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
type = "ingress"
}
resource "aws_security_group_rule" "rule_8080" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 8080
to_port = 8080
description = ""
protocol = "tcp"
security_group_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
type = "ingress"
}
resource "aws_security_group_rule" "rule_53_tcp" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 53
to_port = 53
description = ""
protocol = "tcp"
security_group_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
type = "ingress"
}
resource "aws_security_group_rule" "rule_53_udp" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 53
to_port = 53
description = ""
protocol = "udp"
security_group_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
type = "ingress"
}
resource "aws_ec2_tag" "karpenter" {
resource_id = aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
key = "Name"
value = "Hello World"
}