forked from scm2342/rke2-build-hetzner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
81 lines (74 loc) · 2.78 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
locals {
setup_dns = nonsensitive(var.hdns_token != "")
}
module "cluster" {
source = "./modules/hcloud_rke2"
location = var.location
nodes_cidr = var.nodes_cidr
cluster_cidr = var.cluster_cidr
service_cidr = var.service_cidr
cluster_name = var.cluster_name
domain = var.domain
master_type = var.master_type
agent_type = var.agent_type
agent_count = var.agent_count
image = var.image
rke2_version = var.rke2_version
}
module "dns" {
source = "./modules/hdns"
count = local.setup_dns ? 1 : 0
zone = var.domain
cluster_name = var.cluster_name
lb_ipv4 = module.cluster.lb_ipv4
lb_ipv6 = module.cluster.lb_ipv6
}
module "ccm" {
source = "./modules/hcloud_ccm"
hcloud_ccm_version = var.hcloud_ccm_version
hcloud_token = var.hcloud_token
network = module.cluster.network
cluster_cidr = module.cluster.cluster_cidr
}
module "csi" {
depends_on = [module.ccm]
source = "./modules/hcloud_csi"
count = var.use_hcloud_storage ? 1 : 0
hcloud_csi_version = var.hcloud_csi_version
hcloud_secret = module.ccm.hcloud_secret
default_storage_class = !var.use_longhorn
}
module "cert_manager" {
depends_on = [module.ccm]
source = "granito-source/cert-manager/kubernetes"
version = "~> 0.3.0"
cert_manager_version = var.cert_manager_version
keep_crds = false
acme_email = var.acme_email
ingress_class = module.cluster.ingress_class
}
module "headlamp" {
depends_on = [module.ccm]
source = "granito-source/headlamp/kubernetes"
version = "~> 0.2.0"
count = var.use_headlamp ? 1 : 0
headlamp_version = var.headlamp_version
host = "headlamp.${module.cluster.fqdn}"
ingress_class = module.cluster.ingress_class
issuer_name = var.use_staging_issuer ? module.cert_manager.staging_cluster_issuer : module.cert_manager.cluster_issuer
}
module "longhorn" {
depends_on = [module.ccm]
source = "granito-source/longhorn/kubernetes"
version = "~> 0.3.0"
count = var.use_longhorn ? 1 : 0
longhorn_version = var.longhorn_version
host = "longhorn.${module.cluster.fqdn}"
password = var.longhorn_password
ingress_class = module.cluster.ingress_class
issuer_name = var.use_staging_issuer ? module.cert_manager.staging_cluster_issuer : module.cert_manager.cluster_issuer
backup_target = var.longhorn_backup_target
aws_endpoints = var.longhorn_aws_endpoints
aws_access_key_id = var.longhorn_aws_access_key_id
aws_secret_access_key = var.longhorn_aws_secret_access_key
}