-
Notifications
You must be signed in to change notification settings - Fork 1
/
variables.tf
647 lines (539 loc) · 20.1 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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
// region terraform-aws-modules/eks
variable "cluster_enabled_log_types" {
type = list(string)
description = "A list of the desired control plane logging to enable. For more information, see Amazon EKS Control Plane Logging documentation (https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html)"
default = []
}
variable "cluster_log_kms_key_id" {
type = string
description = "If a KMS Key ARN is set, this key will be used to encrypt the corresponding log group. Please be sure that the KMS Key has an appropriate key policy (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/encrypt-log-data-kms.html)"
default = ""
}
variable "cluster_log_retention_in_days" {
type = number
description = "Number of days to retain log events. Default retention - 90 days"
default = 90
}
variable "cluster_name" {
type = string
description = "Name of the EKS cluster. Also used as a prefix in names of related resources"
default = null
}
variable "cluster_security_group_id" {
type = string
description = "If provided, the EKS cluster will be attached to this security group. If not given, a security group will be created with necessary ingress/egress to work with the workers"
default = ""
}
variable "cluster_version" {
type = string
description = "Kubernetes version to use for the EKS cluster"
default = "1.18"
}
variable "kubeconfig_output_path" {
type = string
description = "Where to save the Kubectl config file (if `write_kubeconfig = true`). Assumed to be a directory if the value ends with a forward slash `/`"
default = "./"
}
variable "kubeconfig_file_permission" {
type = string
description = "File permission of the Kubectl config file containing cluster configuration saved to `kubeconfig_output_path.`"
default = "0600"
}
variable "write_kubeconfig" {
type = bool
description = "Whether to write a Kubectl config file containing the cluster configuration. Saved to `kubeconfig_output_path`"
default = true
}
variable "manage_aws_auth" {
description = "Whether to apply the aws-auth configmap file"
default = true
}
variable "aws_auth_additional_labels" {
type = map(string)
description = "Additional kubernetes labels applied on aws-auth ConfigMap"
default = {}
}
variable "map_accounts" {
description = "Additional AWS account numbers to add to the aws-auth configmap. See examples/basic/variables.tf for example format"
type = list(string)
default = []
}
variable "map_roles" {
type = list(object({
rolearn = string
username = string
groups = list(string)
}))
description = "Additional IAM roles to add to the aws-auth configmap. See examples/basic/variables.tf for example format"
default = []
}
variable "map_users" {
type = list(object({
userarn = string
username = string
groups = list(string)
}))
description = "Additional IAM users to add to the aws-auth configmap. See examples/basic/variables.tf for example format"
default = []
}
variable "subnets" {
type = list(string)
description = "A list of subnets to place the EKS cluster and workers within"
default = null
}
variable "tags" {
type = map(string)
description = "A map of tags to add to all resources. Tags added to launch configuration or templates override these values for ASG Tags only"
default = {}
}
variable "vpc_id" {
type = string
description = "VPC where the cluster and workers will be deployed"
default = null
}
variable "worker_groups" {
type = any
description = "A list of maps defining worker group configurations to be defined using AWS Launch Configurations. See workers_group_defaults for valid keys"
default = [ // Create a dummy worker group to allow IAM resources to be created (ref: https://git.io/JklBL).
{
asg_desired_capacity = 0
asg_max_size = 0
asg_min_size = 0
}
]
}
variable "workers_group_defaults" {
type = any
description = "Override default values for target groups. See workers_group_defaults_defaults in local.tf for valid keys"
default = {}
}
variable "worker_groups_launch_template" {
type = any
description = "A list of maps defining worker group configurations to be defined using AWS Launch Templates. See workers_group_defaults for valid keys"
default = []
}
variable "worker_security_group_id" {
type = string
description = "If provided, all workers will be attached to this security group. If not given, a security group will be created with necessary ingress/egress to work with the EKS cluster"
default = ""
}
variable "worker_ami_name_filter" {
type = string
description = "Name filter for AWS EKS worker AMI. If not provided, the latest official AMI for the specified 'cluster_version' is used"
default = ""
}
variable "worker_ami_name_filter_windows" {
type = string
description = "Name filter for AWS EKS Windows worker AMI. If not provided, the latest official AMI for the specified 'cluster_version' is used"
default = ""
}
variable "worker_ami_owner_id" {
type = string
description = "The ID of the owner for the AMI to use for the AWS EKS workers. Valid values are an AWS account ID, 'self' (the current account), or an AWS owner alias (e.g. 'amazon', 'aws-marketplace', 'microsoft')"
default = "amazon"
}
variable "worker_ami_owner_id_windows" {
type = string
description = "The ID of the owner for the AMI to use for the AWS EKS Windows workers. Valid values are an AWS account ID, 'self' (the current account), or an AWS owner alias (e.g. 'amazon', 'aws-marketplace', 'microsoft')"
default = "amazon"
}
variable "worker_additional_security_group_ids" {
type = list(string)
description = "A list of additional security group ids to attach to worker instances"
default = []
}
variable "worker_sg_ingress_from_port" {
type = number
description = "Minimum port number from which pods will accept communication. Must be changed to a lower value if some pods in your cluster will expose a port lower than 1025 (e.g. 22, 80, or 443)"
default = 1025
}
variable "workers_additional_policies" {
type = list(string)
description = "Additional policies to be added to workers"
default = []
}
variable "kubeconfig_aws_authenticator_command" {
type = string
description = "Command to use to fetch AWS EKS credentials"
default = "aws-iam-authenticator"
}
variable "kubeconfig_aws_authenticator_command_args" {
type = list(string)
description = "Default arguments passed to the authenticator command. Defaults to [token -i $cluster_name]"
default = []
}
variable "kubeconfig_aws_authenticator_additional_args" {
type = list(string)
description = "Any additional arguments to pass to the authenticator such as the role to assume. e.g. [\"-r\", \"MyEksRole\"]"
default = []
}
variable "kubeconfig_aws_authenticator_env_variables" {
type = map(string)
description = "Environment variables that should be used when executing the authenticator. e.g. { AWS_PROFILE = \"eks\"}"
default = {}
}
variable "kubeconfig_name" {
type = string
description = "Override the default name used for items kubeconfig"
default = ""
}
variable "cluster_create_timeout" {
type = string
description = "Timeout value when creating the EKS cluster"
default = "30m"
}
variable "cluster_delete_timeout" {
type = string
description = "Timeout value when deleting the EKS cluster"
default = "15m"
}
variable "cluster_create_security_group" {
type = bool
description = "Whether to create a security group for the cluster or attach the cluster to `cluster_security_group_id`"
default = true
}
variable "worker_create_security_group" {
type = bool
description = "Whether to create a security group for the workers or attach the workers to `worker_security_group_id`"
default = true
}
variable "worker_create_initial_lifecycle_hooks" {
type = bool
description = "Whether to create initial lifecycle hooks provided in worker groups"
default = false
}
variable "worker_create_cluster_primary_security_group_rules" {
type = bool
description = "Whether to create security group rules to allow communication between pods on workers and pods using the primary cluster security group"
default = false
}
variable "permissions_boundary" {
type = string
description = "If provided, all IAM roles will be created with this permissions boundary attached"
default = null
}
variable "iam_path" {
type = string
description = "If provided, all IAM roles will be created on this path"
default = "/"
}
variable "cluster_create_endpoint_private_access_sg_rule" {
type = bool
description = "Whether to create security group rules for the access to the Amazon EKS private API server endpoint"
default = false
}
variable "cluster_endpoint_private_access_cidrs" {
type = list(string)
description = "List of CIDR blocks which can access the Amazon EKS private API server endpoint"
default = null
}
variable "cluster_endpoint_private_access" {
type = bool
description = "Indicates whether or not the Amazon EKS private API server endpoint is enabled"
default = false
}
variable "cluster_endpoint_public_access" {
type = bool
description = "Indicates whether or not the Amazon EKS public API server endpoint is enabled"
default = true
}
variable "cluster_endpoint_public_access_cidrs" {
type = list(string)
description = "List of CIDR blocks which can access the Amazon EKS public API server endpoint"
default = ["0.0.0.0/0"]
}
variable "manage_cluster_iam_resources" {
type = bool
description = "Whether to let the module manage cluster IAM resources. If set to false, cluster_iam_role_name must be specified"
default = true
}
variable "cluster_iam_role_name" {
type = string
description = "IAM role name for the cluster. Only applicable if manage_cluster_iam_resources is set to false"
default = ""
}
variable "manage_worker_iam_resources" {
type = bool
description = "Whether to let the module manage worker IAM resources. If set to false, iam_instance_profile_name must be specified for workers"
default = true
}
variable "workers_role_name" {
type = string
description = "User defined workers role name"
default = ""
}
variable "attach_worker_cni_policy" {
type = bool
description = "Whether to attach the Amazon managed `AmazonEKS_CNI_Policy` IAM policy to the default worker IAM role. WARNING: If set `false` the permissions must be assigned to the `aws-node` DaemonSet pods via another method or nodes will not be able to join the cluster"
default = true
}
variable "create_eks" {
type = bool
description = "Controls whether EKS resources should be created (it affects almost all resources)"
default = true
}
variable "node_groups_defaults" {
type = any
description = "Map of values to be applied to all node groups. See `node_groups` module's documentation for more details"
default = {}
}
variable "node_groups" {
type = any
description = "Map of map of node groups to create. See `node_groups` module's documentation for more details"
default = {}
}
variable "enable_irsa" {
type = bool
description = "Whether to create OpenID Connect Provider for EKS to enable IRSA"
default = false
}
variable "eks_oidc_root_ca_thumbprint" {
type = string
description = "Thumbprint of Root CA for EKS OIDC, Valid until 2037"
default = "9e99a48a9960b14926bb7f3b02e22da2b0ab7280"
}
variable "cluster_encryption_config" {
type = list(object({
provider_key_arn = string
resources = list(string)
}))
description = "Configuration block with encryption configuration for the cluster. See examples/secrets_encryption/main.tf for example format"
default = []
}
variable "fargate_profiles" {
type = any
description = "Fargate profiles to create. See `fargate_profile` keys section in fargate submodule's README.md for more details"
default = {}
}
variable "create_fargate_pod_execution_role" {
type = bool
description = "Controls whether the EKS Fargate pod execution IAM role should be created"
default = true
}
variable "fargate_pod_execution_role_name" {
type = string
description = "The IAM Role that provides permissions for the EKS Fargate Profile"
default = null
}
// endregion
// region terraform-aws-modules/vpc
variable "cidr" {
description = "The CIDR block for the VPC"
type = string
default = "10.0.0.0/16"
}
variable "private_subnets" {
description = "A list of private subnets inside the VPC"
type = list(string)
default = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
}
variable "public_subnets" {
description = "A list of public subnets inside the VPC"
type = list(string)
default = ["10.0.4.0/24", "10.0.5.0/24", "10.0.6.0/24"]
}
variable "enable_nat_gateway" {
description = "Should be true if you want to provision NAT Gateways for each of your private networks"
type = bool
default = true
}
variable "single_nat_gateway" {
description = "Should be true if you want to provision a single shared NAT Gateway across all of your private networks"
type = bool
default = true
}
variable "one_nat_gateway_per_az" {
description = "Should be true if you want only one NAT Gateway per availability zone"
type = bool
default = false
}
variable "reuse_nat_ips" {
description = "Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external_nat_ip_ids' variable"
type = bool
default = false
}
variable "external_nat_ip_ids" {
description = "List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse_nat_ips)"
type = list(string)
default = []
}
// endregion
// region spotinst/ocean-eks
variable "spotinst_token" {
type = string
description = "Spot Personal Access token"
}
variable "spotinst_account" {
type = string
description = "Spot account ID"
}
variable "cluster_identifier" {
type = string
description = "Cluster identifier"
default = null
}
variable "ami_id" {
type = string
description = "The image ID for the EKS worker nodes. If none is provided, Terraform will search for the latest version of their EKS optimized worker AMI based on platform"
default = null
}
variable "worker_user_data" {
type = string
description = "User data to pass to worker node instances. If none is provided, a default Linux EKS bootstrap script is used"
default = null
}
variable "root_volume_size" {
type = string
description = "The size (in GiB) to allocate for the root volume"
default = null
}
variable "min_size" {
type = number
description = "The lower limit of worker nodes the Ocean cluster can scale down to"
default = null
}
variable "max_size" {
type = number
description = "The upper limit of worker nodes the Ocean cluster can scale up to"
default = null
}
variable "desired_capacity" {
type = number
description = "The number of worker nodes to launch and maintain in the Ocean cluster"
default = 1
}
variable "key_name" {
type = string
description = "The key pair to attach to the worker nodes launched by Ocean"
default = null
}
variable "associate_public_ip_address" {
type = bool
description = "Associate a public IP address to worker nodes"
default = false
}
variable "whitelist" {
type = list(string)
description = "List of instance types allowed in the Ocean cluster (`whitelist` and `blacklist` are mutually exclusive)"
default = null
}
variable "blacklist" {
type = list(string)
description = "List of instance types not allowed in the Ocean cluster (`whitelist` and `blacklist` are mutually exclusive)"
default = null
}
variable "create_ocean" {
type = bool
description = "Controls whether Ocean should be created (it affects all Ocean resources)"
default = true
}
variable "spot_percentage" {
type = number
description = "Sets the percentage of nodes that should be Spot (vs On-Demand) in the cluster"
default = null
}
variable "autoscaler_is_enabled" {
type = bool
description = "Controls whether Ocean Auto Scaler should be enabled"
default = true
}
variable "autoscaler_is_auto_config" {
type = bool
description = "Controls whether Ocean Auto Scaler should be auto configured"
default = true
}
variable "autoscaler_headroom_percentage" {
type = number
description = "Sets the auto headroom percentage (a number in the range [0, 200]) which controls the percentage of headroom from the cluster. Relevant only when `autoscale_is_auto_config` toggled on"
default = null
}
variable "autoscaler_headroom_cpu_per_unit" {
type = number
description = "Configures the number of CPUs to allocate the headroom (CPUs are denoted in millicores, where 1000 millicores = 1 vCPU)"
default = null
}
variable "autoscaler_headroom_gpu_per_unit" {
type = number
description = "Configures the number of GPUs to allocate the headroom"
default = null
}
variable "autoscaler_headroom_memory_per_unit" {
type = number
description = "Configures the amount of memory (MB) to allocate the headroom"
default = null
}
variable "autoscaler_headroom_num_of_units" {
type = number
description = "Sets the number of units to retain as headroom, where each unit has the defined headroom CPU and memory"
default = null
}
variable "autoscaler_cooldown" {
type = number
description = "Sets cooldown period between scaling actions"
default = null
}
variable "autoscaler_max_scale_down_percentage" {
type = number
description = "Sets the maximum percentage (a number in the range [1, 100]) to scale down"
default = null
}
variable "autoscaler_resource_limits_max_vcpu" {
type = number
description = "Sets the maximum cpu in vCPU units that can be allocated to the cluster"
default = null
}
variable "autoscaler_resource_limits_max_memory_gib" {
type = number
description = "Sets the maximum memory in GiB units that can be allocated to the cluster"
default = null
}
variable "update_policy" {
type = object({
should_roll = bool
batch_size_percentage = number
launch_spec_ids = list(string)
})
description = "Configures the cluster update policy"
default = null
}
// endregion
// region spotinst/ocean-controller
variable "controller_disable_auto_update" {
type = bool
description = "Controls whether the auto-update feature should be disabled for the Ocean Controller"
default = false
}
variable "controller_image" {
type = string
description = "Set the Docker image name for the Ocean Controller that should be deployed"
default = "gcr.io/spotinst-artifacts/kubernetes-cluster-controller"
}
variable "controller_node_selector" {
type = map(string)
description = "Specifies the node selector which must match a node's labels for the Ocean Controller resources to be scheduled on that node"
default = null
}
variable "controller_resources_limits" {
type = map(any)
description = "Specifies the definition of the maximum amount of compute resources allowed"
default = null
// default = {
// cpu = "0.5"
// memory = "512Mi"
// }
}
variable "controller_resources_requests" {
type = map(any)
description = "Specifies the definition of the minimum amount of compute resources required"
default = null
// default = {
// cpu = "0.5"
// memory = "512Mi"
// }
}
variable "image_pull_policy" {
type = string
description = "Image pull policy (one of: Always, Never, IfNotPresent)"
default = "Always"
}
// endregion