-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
477 lines (402 loc) · 14.9 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
# Copyright (c) 2024 Oracle Corporation and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
### ORM Variables
variable "compartment_ocid" {
type = string
default = null
description = "A compartment OCID automatically populated by Resource Manager."
}
variable "current_user_ocid" {
type = string
default = null
description = "A user OCID automatically populated by Resource Manager."
}
variable "region" {
type = string
default = null
description = "The OCI region where OKE resources will be created."
}
variable "tenancy_ocid" {
type = string
default = null
description = "The tenancy id of the OCI Cloud Account in which to create the resources."
}
### OKE Module - Common Variables
variable "create_operator_and_bastion" {
type = bool
default = true
description = "Whether to create bastion and operator host."
}
variable "ssh_public_key" {
type = string
description = "The contents of the SSH public key file. Used to allow login for workers/bastion/operator. This public key "
}
variable "state_id" {
type = string
default = null
description = "Optional Terraform state_id used to identify the resources of this deployment."
}
### OKE Module - Bastion Variables
variable "bastion_allowed_cidrs" {
type = list(string)
default = ["0.0.0.0/0"]
description = "A list of CIDR blocks to allow SSH access to the bastion host."
}
variable "bastion_image_os" {
type = string
default = "Oracle Linux"
description = "Image ID for created bastion instance."
}
variable "bastion_image_os_version" {
type = string
default = "8"
description = "Bastion image operating system version when bastion_image_type = 'platform'."
}
variable "bastion_image_type" {
type = string
default = "platform"
description = "Whether to use a platform or custom image for the created bastion instance. When custom is set, the bastion_image_id must be specified."
validation {
condition = contains(["platform", "custom"], var.bastion_image_type)
error_message = "The bastion_image_type can be only `platform` or `custom`."
}
}
variable "bastion_image_id" {
type = string
default = null
description = "Image ID for created bastion instance."
}
variable "bastion_user" {
type = string
default = "opc"
description = "User for SSH access through bastion host."
}
### OKE Module - Operator Variables
variable "create_operator_policy_to_manage_cluster" {
default = true
description = "Whether to create minimal IAM policy to allow the operator host to manage the cluster."
type = bool
}
variable "operator_allowed_cidrs" {
type = list(string)
default = ["0.0.0.0/0"]
description = "List with allowed CIDR blocks to connect to the operator host."
}
variable "operator_image_os" {
type = string
default = "Oracle Linux"
description = "Operator image operating system name when operator_image_type = 'platform'."
}
variable "operator_image_os_version" {
type = string
default = "8"
description = "Operator image operating system version when operator_image_type = 'platform'."
}
variable "operator_image_type" {
type = string
default = "platform"
description = "Whether to use a platform or custom image for the created operator instance. When custom is set, the operator_image_id must be specified."
validation {
condition = contains(["platform", "custom"], var.operator_image_type)
error_message = "The operator_image_type can be only `platform` or `custom`."
}
}
variable "operator_install_kubectl_from_repo" {
default = false
description = "Whether to install kubectl on the created operator host from olcne repo."
type = bool
}
variable "operator_image_id" {
type = string
default = null
description = "Image ID for created operator instance."
}
variable "operator_user" {
type = string
default = "opc"
description = "User for SSH access to operator host."
}
### OKE Module - Cluster Variables
variable "create_cluster" {
type = bool
default = true
description = "Whether to create the OKE cluster and dependent resources."
}
variable "cluster_name" {
type = string
default = "oke"
description = "The name of oke cluster."
}
variable "cluster_type" {
default = "enhanced"
description = "The cluster type. See <a href=https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengworkingwithenhancedclusters.htm>Working with Enhanced Clusters and Basic Clusters</a> for more information."
type = string
validation {
condition = contains(["basic", "enhanced"], lower(var.cluster_type))
error_message = "Accepted values are 'basic' or 'enhanced'."
}
}
variable "cni_type" {
type = string
default = "flannel"
description = "The CNI for the cluster: 'flannel' or 'npn'. See <a href=https://docs.oracle.com/en-us/iaas/Content/ContEng/Concepts/contengpodnetworking.htm>Pod Networking</a>."
validation {
condition = contains(["flannel", "npn"], var.cni_type)
error_message = "The cni_type can be only `flannel` or `npn`."
}
}
variable "control_plane_is_public" {
type = bool
default = true
description = "Whether the Kubernetes control plane endpoint should be allocated a public IP address to enable access over public internet."
}
variable "control_plane_allowed_cidrs" {
type = list(string)
default = ["0.0.0.0/0"]
description = "The list of CIDR blocks from which the control plane can be accessed."
}
variable "create_vcn" {
type = bool
default = true
description = "Whether to create a Virtual Cloud Network."
}
variable "kubernetes_version" {
type = string
default = "v1.30.1"
description = "The version of kubernetes to use when provisioning OKE."
}
variable "load_balancers" {
default = "both"
description = "The type of subnets to create for load balancers."
type = string
validation {
condition = contains(["public", "internal", "both"], var.load_balancers)
error_message = "Accepted values are public, internal or both."
}
}
variable "preferred_load_balancer" {
default = "public"
description = "The preferred load balancer subnets that OKE will automatically choose when creating a load balancer. Valid values are 'public' or 'internal'. If 'public' is chosen, the value for load_balancers must be either 'public' or 'both'. If 'private' is chosen, the value for load_balancers must be either 'internal' or 'both'. NOTE: Service annotations for internal load balancers must still be specified regardless of this setting. See <a href=https://github.com/oracle/oci-cloud-controller-manager/blob/master/docs/load-balancer-annotations.md>Load Balancer Annotations</a> for more information."
type = string
validation {
condition = contains(["public", "internal"], var.preferred_load_balancer)
error_message = "Accepted values are public or internal."
}
}
variable "pods_cidr" {
default = "10.244.0.0/16"
description = "The CIDR range used for IP addresses by the pods. A /16 CIDR is generally sufficient. This CIDR should not overlap with any subnet range in the VCN (it can also be outside the VCN CIDR range). Ignored when cni_type = 'npn'."
type = string
}
variable "services_cidr" {
default = "10.96.0.0/16"
description = "The CIDR range used within the cluster by Kubernetes services (ClusterIPs). This CIDR should not overlap with the VCN CIDR range."
type = string
}
### OKE Module - IAM Variables
variable "compartment_id" {
type = string
default = null
description = "The compartment id where resources will be created."
}
variable "create_iam_resources" {
type = bool
default = false
description = "Whether to create IAM dynamic groups, policies, and defined tags."
}
variable "create_iam_defined_tags" {
type = bool
default = false
description = "Whether to create defined tag keys."
}
variable "create_iam_autoscaler_policy" {
default = "auto"
description = "Whether to create an IAM dynamic group and policy rules for Cluster Autoscaler management. Depends on configuration of associated component when set to 'auto'. Ignored when 'create_iam_resources' is false."
type = string
validation {
condition = contains(["never", "auto", "always"], var.create_iam_autoscaler_policy)
error_message = "Accepted values are never, auto, or always"
}
}
variable "create_iam_kms_policy" {
default = "auto"
description = "Whether to create an IAM dynamic group and policy rules for cluster autoscaler. Depends on configuration of associated components when set to 'auto'. Ignored when 'create_iam_resources' is false."
type = string
validation {
condition = contains(["never", "auto", "always"], var.create_iam_kms_policy)
error_message = "Accepted values are never, auto, or always"
}
}
variable "create_iam_operator_policy" {
default = "auto"
description = "Whether to create an IAM dynamic group and policy rules for operator access to the OKE control plane. Depends on configuration of associated components when set to 'auto'. Ignored when 'create_iam_resources' is false."
type = string
validation {
condition = contains(["never", "auto", "always"], var.create_iam_operator_policy)
error_message = "Accepted values are never, auto, or always"
}
}
variable "create_iam_worker_policy" {
default = "auto"
description = "Whether to create an IAM dynamic group and policy rules for self-managed worker nodes. Depends on configuration of associated components when set to 'auto'. Ignored when 'create_iam_resources' is false."
type = string
validation {
condition = contains(["never", "auto", "always"], var.create_iam_worker_policy)
error_message = "Accepted values are never, auto, or always"
}
}
variable "create_iam_tag_namespace" {
type = bool
default = false
description = "Whether to create defined tag namespace."
}
variable "defined_tags" {
default = {
bastion = {}
cluster = {}
iam = {}
network = {}
operator = {}
persistent_volume = {}
service_lb = {}
workers = {}
}
description = "Defined tags to be applied to created resources. Must already exist in the tenancy."
type = any
}
variable "freeform_tags" {
default = {
bastion = {}
cluster = {}
iam = {}
network = {}
operator = {}
persistent_volume = {}
service_lb = {}
workers = {}
}
description = "Freeform tags to be applied to created resources."
type = any
}
variable "tag_namespace" {
type = string
default = "oke"
description = "The tag namespace to use if use_defined_tags=true."
}
variable "use_defined_tags" {
type = bool
default = false
description = "Wether to set defined tags on the creted resources. By default only free-form tags are used."
}
### OKE Module - Network Variables
variable "cidr_vcn" {
type = string
default = "10.0.0.0/16"
description = "The IPv4 CIDR block the VCN will use."
}
variable "cidr_bastion_subnet" {
type = string
default = "10.0.0.0/29"
description = "The IPv4 CIDR block to be used for the bastion subnet."
}
variable "cidr_operator_subnet" {
type = string
default = "10.0.0.64/29"
description = "The IPv4 CIDR block to be used for the operator subnet."
}
variable "cidr_cp_subnet" {
type = string
default = "10.0.0.8/29"
description = "The IPv4 CIDR block to be used for the OKE control plane endpoint."
}
variable "cidr_int_lb_subnet" {
type = string
default = "10.0.0.32/27"
description = "The IPv4 CIDR block to be used for the private load balancer subnet."
}
variable "cidr_pub_lb_subnet" {
type = string
default = "10.0.128.0/27"
description = "The IPv4 CIDR block to be used for the public load balancer subnet."
}
variable "cidr_workers_subnet" {
type = string
default = "10.0.144.0/20"
description = "The IPv4 CIDR block to be used for the kubernetes workers subnet."
}
variable "cidr_pods_subnet" {
type = string
default = "10.0.64.0/18"
description = "The IPv4 CIDR block to be used for the pods subnet."
}
variable "vcn_id" {
type = string
default = null
description = "Optional ID of existing VCN. Takes priority over vcn_name filter. Ignored when `create_vcn = true`."
}
variable "ig_route_table_id" {
default = null
description = "Optional ID of existing public subnets route table in VCN."
type = string
}
variable "nat_route_table_id" {
default = null
description = "Optional ID of existing private subnets route table in VCN."
type = string
}
variable "vcn_name" {
type = string
default = null
description = "Display name for the created VCN. Defaults to 'oke' suffixed with the generated Terraform 'state_id' value."
}
### OKE Module - Worker NodePool Variables
variable "simple_np_flex_shape" {
type = map(any)
default = {
"instanceShape" = "VM.Standard.E4.Flex"
"ocpus" = 2
"memory" = 16
}
description = "The compute shape and configuration to use for the non-GPU kubernetes nodepool."
}
variable "simple_np_size" {
type = number
default = 1
description = "The size of the non-GPU kubernetes nodepool."
}
variable "simple_np_boot_volume_size" {
type = number
default = 50
description = "The boot volume size for the nodes in the non-GPU kubernetes nodepool."
}
### Helm chart deployments
variable "deploy_argo_workflows" {
type = bool
default = true
description = "Controls the deployment of the Argo Workflow helm chart."
}
variable "argo_workflows_user_values_override" {
type = string
default = ""
description = "User provided values to override the Argo Workflows helm chart defaults and those generated by Terraform using the templates."
}
variable "deploy_nginx" {
type = bool
default = true
description = "Controls the deployment of the nginx helm chart."
}
variable "nginx_user_values_override" {
type = string
default = ""
description = "User provided values to override the Nginx helm chart defaults and those generated by Terraform using the templates."
}
variable "deploy_cert_manager" {
type = bool
default = true
description = "Controls the deployment of the cert-manager helm chart."
}
variable "cert_manager_user_values_override" {
type = string
default = ""
description = "User provided values to override the Cert-Manager helm chart defaults and those generated by Terraform using the templates."
}