-
Notifications
You must be signed in to change notification settings - Fork 1
/
eks.tf
51 lines (43 loc) · 1.45 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
# ---------------------------------------------------
# Creating EKS Cluster
# ---------------------------------------------------
data "aws_eks_cluster" "cluster" {
name = module.eks.cluster_id
}
data "aws_eks_cluster_auth" "cluster" {
name = module.eks.cluster_id
}
provider "kubernetes" {
host = data.aws_eks_cluster.cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
token = data.aws_eks_cluster_auth.cluster.token
}
module "eks" {
source = "terraform-aws-modules/eks/aws"
cluster_name = "my-eks"
cluster_version = "1.21"
subnets = [aws_subnet.public1.id, aws_subnet.public2.id, aws_subnet.public3.id, aws_subnet.private1.id, aws_subnet.private2.id, aws_subnet.private3.id]
vpc_id = aws_vpc.myvpc.id
node_groups = {
public = {
subnets = [aws_subnet.public1.id, aws_subnet.public2.id, aws_subnet.public3.id]
desired_capacity = 1
max_capacity = 10
min_capacity = 1
instance_type = var.instance_type
k8s_labels = {
Environment = "public"
}
}
private = {
subnets = [aws_subnet.private1.id, aws_subnet.private2.id, aws_subnet.private3.id]
desired_capacity = 2
max_capacity = 10
min_capacity = 1
instance_type = var.instance_type
k8s_labels = {
Environment = "private"
}
}
}
}