Repository navigation
Expand file tree
/
Copy patheks.tf
More file actions
67 lines (54 loc) · 1.75 KB
/
Copy patheks.tf
File metadata and controls
67 lines (54 loc) · 1.75 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
data "aws_eks_cluster" "cluster" {
name = module.eks.cluster_id
}
data "aws_eks_cluster_auth" "cluster" {
name = module.eks.cluster_id
}
data "aws_caller_identity" "current" {}
data "aws_iam_group" "eks_system_masters" {
group_name = "EKS_system_masters"
}
# Create cluster name
locals {
cluster_name = "${var.cluster_name}-${var.environment}"
}
module "eks" {
# https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest?tab=inputs
source = "terraform-aws-modules/eks/aws"
version = "13.2.1"
cluster_name = local.cluster_name
cluster_version = var.cluster_version
subnets = flatten([aws_subnet.this.*.id])
vpc_id = aws_vpc.this.id
attach_worker_cni_policy = true
enable_irsa = true
map_users = [
for user in data.aws_iam_group.eks_system_masters.users : {
userarn = user.arn
username = user.user_name
groups = ["system:masters"]
}
]
tags = {
createdby = "terraform",
environment = var.environment,
}
worker_groups = [
{
name = "wg"
instance_type = var.instance_type
# Set values for spot instances
kubelet_extra_args = "--node-labels=node.kubernetes.io/lifecycle=spot"
# Set automatic scaling group values
asg_max_size = var.asg_max_capacity
asg_desired_capacity = var.asg_desired_capacity
asg_min_size = var.asg_min_capacity
# Set public IP
public_ip = true
# A list of Application LoadBalancer (ALB) target group ARNs to be associated to the autoscaling group
target_group_arns = [aws_lb_target_group.this.arn]
}
]
# Do not write kubeconfig file
write_kubeconfig = false
}