This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
main.tf
66 lines (57 loc) · 2.09 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
provider "linode" {
token = var.linode_token
}
resource "null_resource" "preflight-checks" {
# Force re-run
triggers = {
key = uuid()
}
provisioner "local-exec" {
command = "${path.cwd}/${path.module}/scripts/local/preflight.sh \"${var.ccm_image}\" \"${var.csi_manifest}\" \"${var.calico_manifest}\""
working_dir = "${path.cwd}/${path.module}"
}
}
module "masters" {
source = "./modules/masters"
label_prefix = var.cluster_name == "" ? terraform.workspace : var.cluster_name
node_class = "master"
node_count = var.masters
node_type = var.server_type_master
linode_token = var.linode_token
ubuntu_version = var.ubuntu_version
docker_version = var.docker_version
k8s_version = var.k8s_version
crictl_version = var.crictl_version
k8s_feature_gates = var.k8s_feature_gates
cni_version = var.cni_version
ssh_public_key = var.ssh_public_key
region = var.region
linode_group = var.cluster_name
//todo variable instead of workspace?
cluster_name = var.cluster_name == "" ? terraform.workspace : var.cluster_name
}
module "nodes" {
source = "./modules/nodes"
label_prefix = var.cluster_name == "" ? terraform.workspace : var.cluster_name
node_class = "node"
node_count = var.nodes
node_type = var.server_type_node
ubuntu_version = var.ubuntu_version
docker_version = var.docker_version
k8s_version = var.k8s_version
crictl_version = var.crictl_version
k8s_feature_gates = var.k8s_feature_gates
cni_version = var.cni_version
ssh_public_key = var.ssh_public_key
region = var.region
linode_group = var.cluster_name
kubeadm_join_command = module.masters.kubeadm_join_command
}
resource "null_resource" "local_kubectl" {
// todo
depends_on = [module.masters]
provisioner "local-exec" {
command = "${path.cwd}/${path.module}/scripts/local/kubectl-conf.sh ${terraform.workspace} ${module.masters.k8s_master_public_ip} ${module.masters.k8s_master_private_ip} ${var.ssh_public_key}"
on_failure = continue
}
}