forked from xunleii/terraform-module-k3s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
137 lines (124 loc) · 5.16 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
variable "depends_on_" {
description = "Resouce dependency of this module."
default = null
}
variable k3s_version {
description = "Specify the k3s version. You can choose from the following release channels or pin the version directly"
type = string
default = "latest"
}
variable name {
description = "K3s cluster domain name (see https://rancher.com/docs/k3s/latest/en/installation/install-options/)."
type = string
default = "cluster.local"
}
variable generate_ca_certificates {
description = "If true, this module will generate the CA certificates (see https://github.com/rancher/k3s/issues/1868#issuecomment-639690634). Otherwise rancher will generate it. This is required to generate kubeconfig"
type = bool
default = true
}
variable kubernetes_certificates {
description = "A list of maps of cerificate-name.[crt/key] : cerficate-value to copied to /var/lib/rancher/k3s/server/tls, if this option is used generate_ca_certificates will be treat as false"
type = list(
object({
file_name = string,
file_content = string
})
)
default = []
}
variable cidr {
description = "K3s network CIDRs (see https://rancher.com/docs/k3s/latest/en/installation/install-options/)."
type = object({
pods = string
services = string
})
default = {
pods = "10.42.0.0/16"
services = "10.43.0.0/16"
}
}
variable drain_timeout {
description = "The length of time to wait before giving up the node draining. Infinite by default."
type = string
default = "0s"
}
variable global_flags {
description = "Add additional installation flags, used by all nodes (see https://rancher.com/docs/k3s/latest/en/installation/install-options/)."
type = list(string)
default = []
}
variable servers {
description = "K3s server nodes definition. The key is used as node name if no name is provided."
type = map(any)
validation {
condition = length(var.servers) > 0
error_message = "At least one server node must be provided."
}
validation {
condition = length(var.servers) % 2 == 1
error_message = "Servers must have an odd number of nodes."
}
validation {
condition = can(values(var.servers)[*].ip)
error_message = "Field servers.<name>.ip is required."
}
validation {
condition = ! can(values(var.servers)[*].connection) || ! contains([for v in var.servers : can(tomap(v.connection))], false)
error_message = "Field servers.<name>.connection must be a valid Terraform connection."
}
validation {
condition = ! can(values(var.servers)[*].flags) || ! contains([for v in var.servers : can(tolist(v.flags))], false)
error_message = "Field servers.<name>.flags must be a list of string."
}
validation {
condition = ! can(values(var.servers)[*].annotations) || ! contains([for v in var.servers : can(tomap(v.annotations))], false)
error_message = "Field servers.<name>.annotations must be a map of string."
}
validation {
condition = ! can(values(var.servers)[*].labels) || ! contains([for v in var.servers : can(tomap(v.labels))], false)
error_message = "Field servers.<name>.labels must be a map of string."
}
validation {
condition = ! can(values(var.servers)[*].taints) || ! contains([for v in var.servers : can(tomap(v.taints))], false)
error_message = "Field servers.<name>.taints must be a map of string."
}
}
variable agents {
description = "K3s agent nodes definitions. The key is used as node name if no name is provided."
type = map(any)
default = {}
validation {
condition = can(values(var.agents)[*].ip)
error_message = "Field agents.<name>.ip is required."
}
validation {
condition = ! can(values(var.agents)[*].connection) || ! contains([for v in var.agents : can(tomap(v.connection))], false)
error_message = "Field agents.<name>.connection must be a valid Terraform connection."
}
validation {
condition = ! can(values(var.agents)[*].flags) || ! contains([for v in var.agents : can(tolist(v.flags))], false)
error_message = "Field agents.<name>.flags must be a list of string."
}
validation {
condition = ! can(values(var.agents)[*].annotations) || ! contains([for v in var.agents : can(tomap(v.annotations))], false)
error_message = "Field agents.<name>.annotations must be a map of string."
}
validation {
condition = ! can(values(var.agents)[*].labels) || ! contains([for v in var.agents : can(tomap(v.labels))], false)
error_message = "Field agents.<name>.labels must be a map of string."
}
validation {
condition = ! can(values(var.agents)[*].taints) || ! contains([for v in var.agents : can(tomap(v.taints))], false)
error_message = "Field agents.<name>.taints must be a map of string."
}
}
variable managed_fields {
description = "List of fields which must be managed by this module (can be annotation, label and/or taint)."
type = list(string)
default = ["annotation", "label", "taint"]
}
variable separator {
description = "Separator used to separates node name and field name (used to manage annotations, labels and taints)."
default = "|"
}