-
Notifications
You must be signed in to change notification settings - Fork 14
/
variables.tf
367 lines (312 loc) · 8.19 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
# Copyright © 2022-2024, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Generic
#
variable "deployment_type" {
type = string
description = "Options are: bare_metal or vsphere"
default = "bare_metal"
}
#
# vSphere
#
variable "vsphere_server" {
type = string
description = "This is the vSphere server for the environment."
default = null
}
variable "vsphere_user" {
type = string
description = "vSphere server user for the environment."
default = null
}
variable "vsphere_password" {
type = string
description = "vSphere server password"
default = null
}
variable "vsphere_datacenter" {
type = string
description = "This is the name of the vSphere data center."
default = null
}
variable "vsphere_datastore" {
type = string
description = "This is the name of the vSphere data store."
default = null
}
variable "vsphere_resource_pool" {
type = string
description = "This is the name of the vSphere resource pool."
default = null
}
variable "vsphere_folder" {
type = string
description = "This is the name of the vSphere folder."
default = null
}
variable "vsphere_template" {
type = string
description = "This is the name of the VM template to clone."
default = null
}
variable "vsphere_network" {
type = string
description = "This is the name of the publicly accessible network for cluster ingress and access."
default = null
}
#
# Misc.
#
variable "gateway" {
type = string
description = "Gateway IP (if using static ips)"
default = ""
}
variable "nat_ip" {
type = string
description = "NAT IP"
default = null
}
variable "netmask" {
type = number
description = "Netmask (if using static ips)"
default = 16
}
variable "dns_servers" {
description = "DNS servers (if using static ips)"
default = ["10.19.1.24", "10.36.1.53"]
type = list(any)
}
variable "inventory" {
type = string
description = "File name and location of the generated inventory file"
default = "inventory"
}
variable "ansible_vars" {
type = string
description = "File name and location of the generated ansible-vars.yaml file"
default = "ansible-vars.yaml"
}
#
# Systems
#
variable "control_plane_ssh_key_name" {
type = string
default = "cp_ssh"
}
# Node Pools
variable "node_pool_defaults" {
description = "Map of kubernetes nodes defaults"
type = any
default = {
cpus = 2
memory = 4096
os_disk = 25
misc_disks = []
count = 0
ip_addresses = []
node_taints = []
node_labels = {}
}
}
variable "node_pools" {
description = "Map of kubernetes nodes"
type = any
default = null
# Nodes defined
validation {
condition = var.node_pools != null ? true : false
error_message = "ERROR: You have not defined any nodes for your cluster. This is a requirement."
}
# Node type validation - Must have at least one control_plane node, one system node, and one other node
validation {
condition = var.node_pools != null ? length(var.node_pools) != 0 ? alltrue([
length(var.node_pools) >= 3,
length(setintersection(keys(var.node_pools), ["control_plane", "system"])) == 2,
]) : false : true
error_message = "ERROR: You must have at least one control_plane node, one system node, and one other node."
}
# TODO
# Node count and ip_addresses must not both be null
validation {
condition = var.node_pools != null ? length(var.node_pools) != 0 ? alltrue([
for k, v in var.node_pools : alltrue([
# lookup(v, "count", false),
# lookup(v, "ip_addresses", false)
])
]) : false : true
error_message = "ERROR: You need to set either the count or ip_addresses value in your node definition."
}
}
# jump
variable "create_jump" {
type = bool
default = false
}
variable "jump_ip" {
type = string
default = null
}
variable "jump_memory" {
type = number
default = 8092
}
variable "jump_num_cpu" {
type = number
default = 4
}
variable "jump_disk_size" {
type = number
default = 100
}
# nfs
variable "create_nfs" {
type = bool
default = false
}
variable "nfs_ip" {
type = string
default = null
}
variable "nfs_memory" {
type = number
default = 16384
}
variable "nfs_num_cpu" {
type = number
default = 4
}
variable "nfs_disk_size" {
type = number
default = 400
}
# container registry - TODO
variable "create_cr" {
type = bool
default = false
}
variable "cr_ip" {
type = string
default = null
}
variable "cr_memory" {
type = number
default = 8092
}
variable "cr_num_cpu" {
type = number
default = 4
}
variable "cr_disk_size" {
type = number
default = 160
}
# postgres
variable "postgres_server_defaults" {
description = ""
type = any
default = {
server_num_cpu = 4 # 4 CPUs
server_memory = 16384 # 16 GiB
server_disk_size = 128 # 128 GiB
server_ip = "" # Assigned values for static IPs
server_version = 15 # PostgreSQL version
server_ssl = "off" # SSL flag
server_ssl_cert_file = "" # PostgreSQL SSL certificate file
server_ssl_key_file = "" # PostgreSQL SSL key file
administrator_login = "postgres" # PostgreSQL admin user - CANNOT BE CHANGED
administrator_password = "my$up3rS3cretPassw0rd" # PostgreSQL admin user password
postgres_system_settings = [{ name = "max_prepared_transactions", value = "1024" }, { name = "max_connections", value = "1024" }]
}
}
variable "postgres_servers" {
description = "Map of PostgreSQL server objects"
type = any
default = null
validation {
condition = var.postgres_servers == null || can([for pg in keys(var.postgres_servers) : regex("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", pg)])
error_message = "ERROR: Postgres Server names must follow a valid naming scheme. Name must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character"
}
}
# Regex for validation : ^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$
# Ansible
variable "ansible_user" {
type = string
default = null
}
variable "ansible_password" {
type = string
default = null
}
# Kubernetes
variable "prefix" {
description = "A prefix used in the name for all cloud resources created by this script. The prefix string must start with lowercase letter and contain only lowercase alphanumeric characters and hyphen or dash(-), but can not start or end with '-'."
type = string
}
variable "system_ssh_keys_dir" {
type = string
default = "~/.ssh"
}
variable "cluster_domain" {
type = string
default = null
}
variable "cluster_version" {
type = string
default = "1.29.7"
}
variable "cluster_cni" {
type = string
default = "calico"
}
variable "cluster_cni_version" {
type = string
default = "3.28.0"
}
variable "cluster_cri" {
type = string
default = "containerd"
}
variable "cluster_cri_version" {
type = string
default = "1.6.28"
}
variable "cluster_service_subnet" {
type = string
default = "10.43.0.0/16"
}
variable "cluster_pod_subnet" {
type = string
default = "10.42.0.0/16"
}
variable "cluster_vip_version" {
type = string
default = "0.7.1"
}
variable "cluster_vip_ip" {
type = string
default = null
}
variable "cluster_vip_fqdn" {
type = string
default = null
}
variable "cluster_lb_type" {
type = string
default = "kube_vip"
validation {
condition = contains(["kube_vip", "metallb"], lower(var.cluster_lb_type))
error_message = "ERROR: Valid values for the cluster_lb_type are: kube_vip, metallb"
}
}
variable "cluster_lb_addresses" {
type = list(any)
default = null
}
variable "iac_tooling" {
description = "Value used to identify the tooling used to generate this provider's infrastructure"
type = string
default = "terraform"
}