-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tf
81 lines (67 loc) · 2.38 KB
/
main.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
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
name = "${var.cluster_name}-vpc"
cidr = "${var.vpc_cidr}"
azs = ["${var.azs}"]
public_subnets = ["${var.vpc_subnet_cidr}"]
public_subnet_tags = "${
map(
"kubernetes.io/cluster/${var.cluster_name}", "shared",
)
}"
enable_dns_hostnames = true
enable_nat_gateway = true
tags = "${
map(
"Name", "${var.cluster_name}-vpc",
"Environment", "testing",
"auto-delete", "false",
"kubernetes.io/cluster/${var.cluster_name}", "shared",
)
}"
}
module "eks_cluster" {
source = "github.com/overdrive3000/terraform_eks_cluster"
cluster_name = "${var.cluster_name}"
vpc_id = "${module.vpc.vpc_id}"
region = "${var.region}"
subnets = ["${module.vpc.public_subnets}"]
}
module "eks_workers" {
source = "github.com/overdrive3000/terraform_eks_nodes"
cluster_name = "${var.cluster_name}"
cluster_endpoint = "${module.eks_cluster.endpoint}"
vpc_id = "${module.vpc.vpc_id}"
control_plane_sg = "${module.eks_cluster.security_group}"
pub_key_pair = "${var.pub_key_pair}"
subnets = ["${module.vpc.public_subnets}"]
instance_profile = "${module.eks_cluster.node_instance_profile}"
instance_type = "m5.large"
desired = "3"
min = "1"
max = "4"
}
module "eks_tooling" {
source = "github.com/overdrive3000/terraform_eks_nodes"
cluster_name = "${var.cluster_name}"
cluster_endpoint = "${module.eks_cluster.endpoint}"
node_name = "tooling"
vpc_id = "${module.vpc.vpc_id}"
control_plane_sg = "${module.eks_cluster.security_group}"
pub_key_pair = "${var.pub_key_pair}"
subnets = ["${module.vpc.public_subnets}"]
instance_profile = "${module.eks_cluster.node_instance_profile}"
instance_type = "t2.medium"
desired = "2"
min = "1"
max = "4"
kubelet_extra_args = "--node-labels=tooling=yes --register-with-taints=tooling=true:NoSchedule"
}
module "join_cluster" {
source = "github.com/overdrive3000/terraform_eks_join_nodes"
cluster_name = "${var.cluster_name}"
region = "${var.region}"
cluster_endpoint = "${module.eks_cluster.endpoint}"
cluster_ca = "${module.eks_cluster.certificate-authority-data}"
role = "${module.eks_cluster.node_role_arn}"
}