forked from kube-hetzner/terraform-hcloud-kube-hetzner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
575 lines (482 loc) · 16.4 KB
/
variables.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
variable "hcloud_token" {
description = "Hetzner Cloud API Token."
type = string
sensitive = true
default = ""
}
variable "microos_x86_snapshot_id" {
description = "MicroOS x86 snapshot ID to be used. Per default empty, image created using create.sh will be used"
type = string
default = ""
}
variable "microos_arm_snapshot_id" {
description = "MicroOS ARM snapshot ID to be used. Per default empty, image created using create.sh will be used"
type = string
default = ""
}
variable "ssh_port" {
description = "The main SSH port to connect to the nodes."
type = number
default = 22
validation {
condition = var.ssh_port >= 0 && var.ssh_port <= 65535
error_message = "The SSH port must use a valid range from 0 to 65535."
}
}
variable "ssh_public_key" {
description = "SSH public Key."
type = string
}
variable "ssh_private_key" {
description = "SSH private Key."
type = string
sensitive = true
}
variable "ssh_hcloud_key_label" {
description = "Additional SSH public Keys by hcloud label. e.g. role=admin"
type = string
default = ""
}
variable "ssh_additional_public_keys" {
description = "Additional SSH public Keys. Use them to grant other team members root access to your cluster nodes."
type = list(string)
default = []
}
variable "hcloud_ssh_key_id" {
description = "If passed, a key already registered within hetzner is used. Otherwise, a new one will be created by the module."
type = string
default = null
}
variable "ssh_max_auth_tries" {
description = "The maximum number of authentication attempts permitted per connection."
type = number
default = 2
}
variable "network_region" {
description = "Default region for network."
type = string
default = "eu-central"
}
variable "network_ipv4_cidr" {
description = "The main network cidr that all subnets will be created upon."
type = string
default = "10.0.0.0/8"
}
variable "cluster_ipv4_cidr" {
description = "Internal Pod CIDR, used for the controller and currently for calico."
type = string
default = "10.42.0.0/16"
}
variable "load_balancer_location" {
description = "Default load balancer location."
type = string
default = "fsn1"
}
variable "load_balancer_type" {
description = "Default load balancer server type."
type = string
default = "lb11"
}
variable "load_balancer_disable_ipv6" {
description = "Disable ipv6 for the load balancer."
type = bool
default = false
}
variable "control_plane_nodepools" {
description = "Number of control plane nodes."
type = list(object({
name = string
server_type = string
location = string
backups = optional(bool)
labels = list(string)
taints = list(string)
count = number
}))
default = []
}
variable "agent_nodepools" {
description = "Number of agent nodes."
type = list(object({
name = string
server_type = string
location = string
backups = optional(bool)
floating_ip = optional(bool)
labels = list(string)
taints = list(string)
count = number
longhorn_volume_size = optional(number)
}))
default = []
}
variable "cluster_autoscaler_image" {
type = string
default = "registry.k8s.io/autoscaling/cluster-autoscaler"
description = "Image of Kubernetes Cluster Autoscaler for Hetzner Cloud to be used."
}
variable "cluster_autoscaler_version" {
type = string
default = "v1.26.2"
description = "Version of Kubernetes Cluster Autoscaler for Hetzner Cloud. Should be aligned with Kubernetes version"
}
variable "autoscaler_nodepools" {
description = "Cluster autoscaler nodepools."
type = list(object({
name = string
server_type = string
location = string
min_nodes = number
max_nodes = number
}))
default = []
}
variable "hetzner_ccm_version" {
type = string
default = null
description = "Version of Kubernetes Cloud Controller Manager for Hetzner Cloud."
}
variable "hetzner_csi_version" {
type = string
default = null
description = "Version of Container Storage Interface driver for Hetzner Cloud."
}
variable "restrict_outbound_traffic" {
type = bool
default = true
description = "Whether or not to restrict the outbound traffic."
}
variable "enable_klipper_metal_lb" {
type = bool
default = false
description = "Use klipper load balancer."
}
variable "etcd_s3_backup" {
description = "Etcd cluster state backup to S3 storage"
type = map(any)
sensitive = true
default = {}
}
variable "ingress_controller" {
type = string
default = "traefik"
description = "The name of the ingress controller."
validation {
condition = contains(["traefik", "nginx", "none"], var.ingress_controller)
error_message = "Must be one of \"traefik\" or \"nginx\" or \"none\""
}
}
variable "ingress_replica_count" {
type = number
default = 0
description = "Number of replicas per ingress controller. 0 means autodetect based on the number of agent nodes."
validation {
condition = var.ingress_replica_count >= 0
error_message = "Number of ingress replicas can't be below 0."
}
}
variable "traefik_redirect_to_https" {
type = bool
default = true
description = "Should traefik redirect http traffic to https."
}
variable "traefik_additional_options" {
type = list(string)
default = []
description = "Additional options to pass to Traefik as a list of strings. These are the ones that go into the additionalArguments section of the Traefik helm values file."
}
variable "traefik_values" {
type = string
default = ""
description = "Additional helm values file to pass to Traefik as 'valuesContent' at the HelmChart."
}
variable "nginx_values" {
type = string
default = ""
description = "Additional helm values file to pass to nginx as 'valuesContent' at the HelmChart."
}
variable "allow_scheduling_on_control_plane" {
type = bool
default = false
description = "Whether to allow non-control-plane workloads to run on the control-plane nodes."
}
variable "enable_metrics_server" {
type = bool
default = true
description = "Whether to enable or disable k3s metric server."
}
variable "initial_k3s_channel" {
type = string
default = "v1.26"
description = "Allows you to specify an initial k3s channel."
validation {
condition = contains(["stable", "latest", "testing", "v1.16", "v1.17", "v1.18", "v1.19", "v1.20", "v1.21", "v1.22", "v1.23", "v1.24", "v1.25", "v1.26"], var.initial_k3s_channel)
error_message = "The initial k3s channel must be one of stable, latest or testing, or any of the minor kube versions like v1.26."
}
}
variable "automatically_upgrade_k3s" {
type = bool
default = true
description = "Whether to automatically upgrade k3s based on the selected channel."
}
variable "automatically_upgrade_os" {
type = bool
default = true
description = "Whether to enable or disable automatic os updates. Defaults to true. Should be disabled for single-node clusters"
}
variable "extra_firewall_rules" {
type = list(any)
default = []
description = "Additional firewall rules to apply to the cluster."
}
variable "use_cluster_name_in_node_name" {
type = bool
default = true
description = "Whether to use the cluster name in the node name."
}
variable "cluster_name" {
type = string
default = "k3s"
description = "Name of the cluster."
validation {
condition = can(regex("^[a-z0-9\\-]+$", var.cluster_name))
error_message = "The cluster name must be in the form of lowercase alphanumeric characters and/or dashes."
}
}
variable "base_domain" {
type = string
default = ""
description = "Base domain of the cluster, used for reserve dns."
validation {
condition = can(regex("^(?:(?:(?:[A-Za-z0-9])|(?:[A-Za-z0-9](?:[A-Za-z0-9\\-]+)?[A-Za-z0-9]))+(\\.))+([A-Za-z]{2,})([\\/?])?([\\/?][A-Za-z0-9\\-%._~:\\/?#\\[\\]@!\\$&\\'\\(\\)\\*\\+,;=]+)?$", var.base_domain)) || var.base_domain == ""
error_message = "It must be a valid domain name (FQDN)."
}
}
variable "placement_group_disable" {
type = bool
default = false
description = "Whether to disable placement groups."
}
variable "disable_network_policy" {
type = bool
default = false
description = "Disable k3s default network policy controller (default false, automatically true for calico and cilium)."
}
variable "cni_plugin" {
type = string
default = "flannel"
description = "CNI plugin for k3s."
validation {
condition = contains(["flannel", "calico", "cilium"], var.cni_plugin)
error_message = "The cni_plugin must be one of \"flannel\", \"calico\", or \"cilium\"."
}
}
variable "cilium_values" {
type = string
default = ""
description = "Additional helm values file to pass to Cilium as 'valuesContent' at the HelmChart."
}
variable "calico_values" {
type = string
default = ""
description = "Just a stub for a future helm implementation. Now it can be used to replace the calico kustomize patch of the calico manifest."
}
variable "enable_longhorn" {
type = bool
default = false
description = "Whether or not to enable Longhorn."
}
variable "longhorn_repository" {
type = string
default = "https://charts.longhorn.io"
description = "By default the official chart which may be incompatible with rancher is used. If you need to fully support rancher switch to https://charts.rancher.io."
}
variable "longhorn_namespace" {
type = string
default = "longhorn-system"
description = "Namespace for longhorn deployment, defaults to 'longhorn-system'"
}
variable "longhorn_fstype" {
type = string
default = "ext4"
description = "The longhorn fstype."
validation {
condition = contains(["ext4", "xfs"], var.longhorn_fstype)
error_message = "Must be one of \"ext4\" or \"xfs\""
}
}
variable "longhorn_replica_count" {
type = number
default = 3
description = "Number of replicas per longhorn volume."
validation {
condition = var.longhorn_replica_count > 0
error_message = "Number of longhorn replicas can't be below 1."
}
}
variable "longhorn_values" {
type = string
default = ""
description = "Additional helm values file to pass to longhorn as 'valuesContent' at the HelmChart."
}
variable "disable_hetzner_csi" {
type = bool
default = false
description = "Disable hetzner csi driver."
}
variable "enable_csi_driver_smb" {
type = bool
default = false
description = "Whether or not to enable csi-driver-smb."
}
variable "csi_driver_smb_values" {
type = string
default = ""
description = "Additional helm values file to pass to csi-driver-smb as 'valuesContent' at the HelmChart."
}
variable "enable_cert_manager" {
type = bool
default = true
description = "Enable cert manager."
}
variable "cert_manager_values" {
type = string
default = ""
description = "Additional helm values file to pass to Cert-Manager as 'valuesContent' at the HelmChart."
}
variable "enable_rancher" {
type = bool
default = false
description = "Enable rancher."
}
variable "rancher_install_channel" {
type = string
default = "stable"
description = "The rancher installation channel."
validation {
condition = contains(["stable", "latest"], var.rancher_install_channel)
error_message = "The allowed values for the Rancher install channel are stable or latest."
}
}
variable "rancher_hostname" {
type = string
default = ""
description = "The rancher hostname."
validation {
condition = can(regex("^(?:(?:(?:[A-Za-z0-9])|(?:[A-Za-z0-9](?:[A-Za-z0-9\\-]+)?[A-Za-z0-9]))+(\\.))+([A-Za-z]{2,})([\\/?])?([\\/?][A-Za-z0-9\\-%._~:\\/?#\\[\\]@!\\$&\\'\\(\\)\\*\\+,;=]+)?$", var.rancher_hostname)) || var.rancher_hostname == ""
error_message = "It must be a valid domain name (FQDN)."
}
}
variable "lb_hostname" {
type = string
default = ""
description = "The Hetzner Load Balancer hostname, for either Traefik or Ingress-Nginx."
validation {
condition = can(regex("^(?:(?:(?:[A-Za-z0-9])|(?:[A-Za-z0-9](?:[A-Za-z0-9\\-]+)?[A-Za-z0-9]))+(\\.))+([A-Za-z]{2,})([\\/?])?([\\/?][A-Za-z0-9\\-%._~:\\/?#\\[\\]@!\\$&\\'\\(\\)\\*\\+,;=]+)?$", var.lb_hostname)) || var.lb_hostname == ""
error_message = "It must be a valid domain name (FQDN)."
}
}
variable "rancher_registration_manifest_url" {
type = string
description = "The url of a rancher registration manifest to apply. (see https://rancher.com/docs/rancher/v2.6/en/cluster-provisioning/registered-clusters/)."
default = ""
sensitive = true
}
variable "rancher_bootstrap_password" {
type = string
default = ""
description = "Rancher bootstrap password."
sensitive = true
validation {
condition = (length(var.rancher_bootstrap_password) >= 48) || (length(var.rancher_bootstrap_password) == 0)
error_message = "The Rancher bootstrap password must be at least 48 characters long."
}
}
variable "rancher_values" {
type = string
default = ""
description = "Additional helm values file to pass to Rancher as 'valuesContent' at the HelmChart."
}
variable "kured_version" {
type = string
default = null
description = "Version of Kured."
}
variable "kured_options" {
type = map(string)
default = {}
}
variable "block_icmp_ping_in" {
type = bool
default = false
description = "Block entering ICMP ping."
}
variable "use_control_plane_lb" {
type = bool
default = false
description = "When this is enabled, rather than the first node, all external traffic will be routed via a control-plane loadbalancer, allowing for high availability."
}
variable "dns_servers" {
type = list(string)
default = ["1.1.1.1", "8.8.8.8", "9.9.9.9"]
description = "IP Addresses to use for the DNS Servers, set to an empty list to use the ones provided by Hetzner. The length is limited to 3 entries, more entries is not supported by kubernetes"
validation {
condition = length(var.dns_servers) <= 3
error_message = "The list must have no more than 3 items."
}
}
variable "additional_k3s_environment" {
type = map(any)
default = {}
description = "Additional environment variables for the k3s binary. See for example https://docs.k3s.io/advanced#configuring-an-http-proxy ."
}
variable "preinstall_exec" {
type = list(string)
default = []
description = "Additional to execute before the install calls, for example fetching and installing certs."
}
variable "extra_kustomize_parameters" {
type = map(any)
default = {}
description = "All values will be passed to the `kustomization.tmp.yml` template."
}
variable "create_kubeconfig" {
type = bool
default = true
description = "Create the kubeconfig as a local file resource. Should be disabled for automatic runs."
}
variable "create_kustomization" {
type = bool
default = true
description = "Create the kustomization backup as a local file resource. Should be disabled for automatic runs."
}
variable "enable_wireguard" {
type = bool
default = false
description = "Use wireguard-native as the backend for CNI."
}
variable "control_planes_custom_config" {
type = map(any)
default = {}
description = "Custom control plane configuration e.g to allow etcd monitoring."
}
variable "k3s_registries" {
description = "K3S registries.yml contents. It used to access private docker registries."
default = " "
type = string
}
variable "additional_tls_sans" {
description = "Additional TLS SANs to allow connection to control-plane through it."
default = []
type = list(string)
}
variable "calico_version" {
type = string
default = null
description = "Version of Calico."
}
variable "k3s_exec_server_args" {
type = string
default = ""
description = "The control plane is started with `k3s server {k3s_exec_server_args}`. Use this to add kube-apiserver-arg for example."
}