-
-
Notifications
You must be signed in to change notification settings - Fork 75
/
variables.tf
522 lines (433 loc) · 17.7 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
variable "cluster_name" {
type = string
description = "The name of the EKS cluster"
}
variable "cluster_endpoint" {
type = string
description = "EKS cluster endpoint"
}
variable "cluster_certificate_authority_data" {
type = string
description = "The base64 encoded certificate data required to communicate with the cluster"
}
variable "cluster_security_group_ingress_enabled" {
type = bool
description = "Whether to enable the EKS cluster Security Group as ingress to workers Security Group"
default = true
}
variable "cluster_security_group_id" {
type = string
description = "Security Group ID of the EKS cluster"
}
variable "vpc_id" {
type = string
description = "VPC ID for the EKS cluster"
}
variable "allowed_security_groups" {
type = list(string)
default = []
description = "List of Security Group IDs to be allowed to connect to the worker nodes"
}
variable "allowed_cidr_blocks" {
type = list(string)
default = []
description = "List of CIDR blocks to be allowed to connect to the worker nodes"
}
variable "metadata_http_endpoint_enabled" {
type = bool
default = true
description = "Set false to disable the Instance Metadata Service."
}
variable "metadata_http_put_response_hop_limit" {
type = number
default = 2
description = <<-EOT
The desired HTTP PUT response hop limit (between 1 and 64) for Instance Metadata Service requests.
The default is `2` to support containerized workloads.
EOT
}
variable "metadata_http_tokens_required" {
type = bool
default = true
description = "Set true to require IMDS session tokens, disabling Instance Metadata Service Version 1."
}
variable "instance_initiated_shutdown_behavior" {
type = string
description = "Shutdown behavior for the instances. Can be `stop` or `terminate`"
default = "terminate"
}
variable "image_id" {
type = string
description = "EC2 image ID to launch. If not provided, the module will lookup the most recent EKS AMI. See https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami.html for more details on EKS-optimized images"
default = ""
}
variable "use_custom_image_id" {
type = bool
description = "If set to `true`, will use variable `image_id` for the EKS workers inside autoscaling group"
default = false
}
variable "eks_worker_ami_name_filter" {
type = string
description = "AMI name filter to lookup the most recent EKS AMI if `image_id` is not provided"
default = "amazon-eks-node-*"
}
variable "eks_worker_ami_name_regex" {
type = string
description = "A regex string to apply to the AMI list returned by AWS"
default = "^amazon-eks-node-[0-9,.]+-v[0-9]{8}$"
}
variable "instance_type" {
type = string
description = "Instance type to launch"
}
variable "key_name" {
type = string
description = "SSH key name that should be used for the instance"
default = ""
}
variable "associate_public_ip_address" {
type = bool
description = "Associate a public IP address with an instance in a VPC"
default = false
}
variable "enable_monitoring" {
type = bool
description = "Enable/disable detailed monitoring"
default = true
}
variable "ebs_optimized" {
type = bool
description = "If true, the launched EC2 instance will be EBS-optimized"
default = false
}
variable "disable_api_termination" {
type = bool
description = "If `true`, enables EC2 Instance Termination Protection"
default = false
}
variable "max_size" {
type = number
description = "The maximum size of the autoscale group"
}
variable "min_size" {
type = number
description = "The minimum size of the autoscale group"
}
variable "subnet_ids" {
description = "A list of subnet IDs to launch resources in"
type = list(string)
}
variable "default_cooldown" {
type = number
description = "The amount of time, in seconds, after a scaling activity completes before another scaling activity can start"
default = 300
}
variable "health_check_grace_period" {
type = number
description = "Time (in seconds) after instance comes into service before checking health"
default = 300
}
variable "health_check_type" {
type = string
description = "Controls how health checking is done. Valid values are `EC2` or `ELB`"
default = "EC2"
}
variable "force_delete" {
type = bool
description = "Allows deleting the autoscaling group without waiting for all instances in the pool to terminate. You can force an autoscaling group to delete even if it's in the process of scaling a resource. Normally, Terraform drains all the instances before deleting the group. This bypasses that behavior and potentially leaves resources dangling"
default = false
}
variable "load_balancers" {
type = list(string)
description = "A list of elastic load balancer names to add to the autoscaling group. Only valid for classic load balancers. For ALBs, use `target_group_arns` instead"
default = []
}
variable "target_group_arns" {
type = list(string)
description = "A list of aws_alb_target_group ARNs, for use with Application Load Balancing"
default = []
}
variable "termination_policies" {
description = "A list of policies to decide how the instances in the auto scale group should be terminated. The allowed values are `OldestInstance`, `NewestInstance`, `OldestLaunchConfiguration`, `ClosestToNextInstanceHour`, `Default`"
type = list(string)
default = ["Default"]
}
variable "suspended_processes" {
type = list(string)
description = "A list of processes to suspend for the AutoScaling Group. The allowed values are `Launch`, `Terminate`, `HealthCheck`, `ReplaceUnhealthy`, `AZRebalance`, `AlarmNotification`, `ScheduledActions`, `AddToLoadBalancer`. Note that if you suspend either the `Launch` or `Terminate` process types, it can prevent your autoscaling group from functioning properly."
default = []
}
variable "placement_group" {
type = string
description = "The name of the placement group into which you'll launch your instances, if any"
default = ""
}
variable "metrics_granularity" {
type = string
description = "The granularity to associate with the metrics to collect. The only valid value is 1Minute"
default = "1Minute"
}
variable "enabled_metrics" {
description = "A list of metrics to collect. The allowed values are `GroupMinSize`, `GroupMaxSize`, `GroupDesiredCapacity`, `GroupInServiceInstances`, `GroupPendingInstances`, `GroupStandbyInstances`, `GroupTerminatingInstances`, `GroupTotalInstances`"
type = list(string)
default = [
"GroupMinSize",
"GroupMaxSize",
"GroupDesiredCapacity",
"GroupInServiceInstances",
"GroupPendingInstances",
"GroupStandbyInstances",
"GroupTerminatingInstances",
"GroupTotalInstances",
]
}
variable "wait_for_capacity_timeout" {
type = string
description = "A maximum duration that Terraform should wait for ASG instances to be healthy before timing out. Setting this to '0' causes Terraform to skip all Capacity Waiting behavior"
default = "10m"
}
variable "min_elb_capacity" {
type = number
description = "Setting this causes Terraform to wait for this number of instances to show up healthy in the ELB only on creation. Updates will not wait on ELB instance number changes"
default = 0
}
variable "wait_for_elb_capacity" {
type = number
description = "Setting this will cause Terraform to wait for exactly this number of healthy instances in all attached load balancers on both create and update operations. Takes precedence over `min_elb_capacity` behavior"
default = 0
}
variable "protect_from_scale_in" {
type = bool
description = "Allows setting instance protection. The autoscaling group will not select instances with this setting for terminination during scale in events"
default = false
}
variable "service_linked_role_arn" {
type = string
description = "The ARN of the service-linked role that the ASG will use to call other AWS services"
default = ""
}
variable "autoscaling_group_tags" {
type = map(string)
default = {}
description = "Additional tags only for the autoscaling group, e.g. \"k8s.io/cluster-autoscaler/node-template/taint/dedicated\" = \"ci-cd:NoSchedule\"."
}
variable "autoscaling_policies_enabled" {
type = bool
default = true
description = "Whether to create `aws_autoscaling_policy` and `aws_cloudwatch_metric_alarm` resources to control Auto Scaling"
}
variable "scale_up_cooldown_seconds" {
type = number
default = 300
description = "The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start"
}
variable "scale_up_scaling_adjustment" {
type = number
default = 1
description = "The number of instances by which to scale. `scale_up_adjustment_type` determines the interpretation of this number (e.g. as an absolute number or as a percentage of the existing Auto Scaling group size). A positive increment adds to the current capacity and a negative value removes from the current capacity"
}
variable "scale_up_adjustment_type" {
type = string
default = "ChangeInCapacity"
description = "Specifies whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are `ChangeInCapacity`, `ExactCapacity` and `PercentChangeInCapacity`"
}
variable "scale_up_policy_type" {
type = string
default = "SimpleScaling"
description = "The scalling policy type, either `SimpleScaling`, `StepScaling` or `TargetTrackingScaling`"
}
variable "scale_down_cooldown_seconds" {
type = number
default = 300
description = "The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start"
}
variable "scale_down_scaling_adjustment" {
type = number
default = -1
description = "The number of instances by which to scale. `scale_down_scaling_adjustment` determines the interpretation of this number (e.g. as an absolute number or as a percentage of the existing Auto Scaling group size). A positive increment adds to the current capacity and a negative value removes from the current capacity"
}
variable "scale_down_adjustment_type" {
type = string
default = "ChangeInCapacity"
description = "Specifies whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are `ChangeInCapacity`, `ExactCapacity` and `PercentChangeInCapacity`"
}
variable "scale_down_policy_type" {
type = string
default = "SimpleScaling"
description = "The scalling policy type, either `SimpleScaling`, `StepScaling` or `TargetTrackingScaling`"
}
variable "cpu_utilization_high_evaluation_periods" {
type = number
default = 2
description = "The number of periods over which data is compared to the specified threshold"
}
variable "cpu_utilization_high_period_seconds" {
type = number
default = 300
description = "The period in seconds over which the specified statistic is applied"
}
variable "cpu_utilization_high_threshold_percent" {
type = number
default = 90
description = "The value against which the specified statistic is compared"
}
variable "cpu_utilization_high_statistic" {
type = string
default = "Average"
description = "The statistic to apply to the alarm's associated metric. Either of the following is supported: `SampleCount`, `Average`, `Sum`, `Minimum`, `Maximum`"
}
variable "cpu_utilization_low_evaluation_periods" {
type = number
default = 2
description = "The number of periods over which data is compared to the specified threshold"
}
variable "cpu_utilization_low_period_seconds" {
type = number
default = 300
description = "The period in seconds over which the specified statistic is applied"
}
variable "cpu_utilization_low_threshold_percent" {
type = number
default = 10
description = "The value against which the specified statistic is compared"
}
variable "cpu_utilization_low_statistic" {
type = string
default = "Average"
description = "The statistic to apply to the alarm's associated metric. Either of the following is supported: `SampleCount`, `Average`, `Sum`, `Minimum`, `Maximum`"
}
variable "bootstrap_extra_args" {
type = string
default = ""
description = "Extra arguments to the `bootstrap.sh` script to enable `--enable-docker-bridge` or `--use-max-pods`"
}
variable "kubelet_extra_args" {
type = string
default = ""
description = "Extra arguments to pass to kubelet, like \"--register-with-taints=dedicated=ci-cd:NoSchedule --node-labels=purpose=ci-worker\""
}
variable "before_cluster_joining_userdata" {
type = string
default = ""
description = "Additional commands to execute on each worker node before joining the EKS cluster (before executing the `bootstrap.sh` script). For mot info, see https://kubedex.com/90-days-of-aws-eks-in-production"
}
variable "after_cluster_joining_userdata" {
type = string
default = ""
description = "Additional commands to execute on each worker node after joining the EKS cluster (after executing the `bootstrap.sh` script). For mot info, see https://kubedex.com/90-days-of-aws-eks-in-production"
}
variable "aws_iam_instance_profile_name" {
type = string
default = ""
description = "The name of the existing instance profile that will be used in autoscaling group for EKS workers. If empty will create a new instance profile."
}
variable "workers_security_group_id" {
type = string
default = ""
description = "The name of the existing security group that will be used in autoscaling group for EKS workers. If empty, a new security group will be created"
}
variable "use_existing_security_group" {
type = bool
description = "If set to `true`, will use variable `workers_security_group_id` to run EKS workers using an existing security group that was created outside of this module, workaround for errors like `count cannot be computed`"
default = false
}
variable "additional_security_group_ids" {
type = list(string)
default = []
description = "Additional list of security groups that will be attached to the autoscaling group"
}
variable "use_existing_aws_iam_instance_profile" {
type = bool
description = "If set to `true`, will use variable `aws_iam_instance_profile_name` to run EKS workers using an existing AWS instance profile that was created outside of this module, workaround for error like `count cannot be computed`"
default = false
}
variable "workers_role_policy_arns" {
type = list(string)
default = []
description = "List of policy ARNs that will be attached to the workers default role on creation"
}
variable "workers_role_policy_arns_count" {
type = number
default = 0
description = "Count of policy ARNs that will be attached to the workers default role on creation. Needed to prevent Terraform error `count can't be computed`"
}
variable "block_device_mappings" {
description = "Specify volumes to attach to the instance besides the volumes specified by the AMI"
type = list(object({
device_name = string
no_device = bool
virtual_name = string
ebs = object({
delete_on_termination = bool
encrypted = bool
iops = number
kms_key_id = string
snapshot_id = string
volume_size = number
volume_type = string
})
}))
default = []
}
variable "instance_market_options" {
description = "The market (purchasing) option for the instances"
type = object({
market_type = string
spot_options = object({
block_duration_minutes = number
instance_interruption_behavior = string
max_price = number
spot_instance_type = string
valid_until = string
})
})
default = null
}
variable "mixed_instances_policy" {
description = "policy to used mixed group of on demand/spot of differing types. Launch template is automatically generated. https://www.terraform.io/docs/providers/aws/r/autoscaling_group.html#mixed_instances_policy-1"
type = object({
instances_distribution = object({
on_demand_allocation_strategy = string
on_demand_base_capacity = number
on_demand_percentage_above_base_capacity = number
spot_allocation_strategy = string
spot_instance_pools = number
spot_max_price = string
})
override = list(object({
instance_type = string
weighted_capacity = number
}))
})
default = null
}
variable "placement" {
description = "The placement specifications of the instances"
type = object({
affinity = string
availability_zone = string
group_name = string
host_id = string
tenancy = string
})
default = null
}
variable "credit_specification" {
description = "Customize the credit specification of the instances"
type = object({
cpu_credits = string
})
default = null
}
variable "elastic_gpu_specifications" {
description = "Specifications of Elastic GPU to attach to the instances"
type = object({
type = string
})
default = null
}
variable "max_instance_lifetime" {
description = "The maximum amount of time, in seconds, that an instance can be in service, values must be either equal to 0 or between 604800 and 31536000 seconds"
type = number
default = null
}