-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy patheks.tf
More file actions
81 lines (69 loc) · 1.73 KB
/
eks.tf
File metadata and controls
81 lines (69 loc) · 1.73 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
# 2. Create EKS cluster.
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "21.3.1"
putin_khuylo = true
name = var.cluster_name
kubernetes_version = var.cluster_version
endpoint_public_access = true
addons = {
coredns = {}
eks-pod-identity-agent = {
before_compute = true
}
kube-proxy = {}
vpc-cni = {
before_compute = true
}
}
vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnets
authentication_mode = "API_AND_CONFIG_MAP"
access_entries = {
for key, arn in var.additional_cluster_admin_arns :
key => {
principal_arn = arn
policy_associations = {
admin = {
policy_arn = "arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy"
access_scope = {
type = "cluster"
}
}
}
}
}
eks_managed_node_groups = {
node_group = {
name = "${var.cluster_name}"
min_size = 2
max_size = 10
desired_size = 2
instance_types = ["m5.large"]
update_config = {
max_unavailable_percentage = 50 # or set `max_unavailable`
}
metadata_options = {
http_put_response_hop_limit = 2
}
}
}
}
# Example additional security group.
resource "aws_security_group" "additional" {
name_prefix = "${var.cluster_name}-additional"
vpc_id = module.vpc.vpc_id
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = [
"10.0.0.0/8",
]
}
}
resource "aws_eks_access_entry" "access_entry" {
cluster_name = var.cluster_name
principal_arn = module.castai-eks-role-iam.instance_profile_role_arn
type = "EC2_LINUX"
}