-
-
Notifications
You must be signed in to change notification settings - Fork 144
/
variables.tf
520 lines (438 loc) · 17.4 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
variable "image_id" {
type = string
description = "The EC2 image ID to launch"
default = ""
}
variable "instance_initiated_shutdown_behavior" {
type = string
description = "Shutdown behavior for the instances. Can be `stop` or `terminate`"
default = "terminate"
}
variable "instance_type" {
type = string
description = "Instance type to launch"
}
variable "iam_instance_profile_name" {
type = string
description = "The IAM instance profile name to associate with launched instances"
default = ""
}
variable "key_name" {
type = string
description = "The SSH key name that should be used for the instance"
default = ""
}
variable "security_group_ids" {
description = "A list of associated security group IDs"
type = list(string)
default = []
}
variable "launch_template_version" {
type = string
description = "Launch template version. Can be version number, `$Latest` or `$Default`"
default = "$Latest"
}
variable "associate_public_ip_address" {
type = bool
description = "Associate a public IP address with an instance in a VPC. If `network_interface_id` is specified, this can only be `false` (see here for more info: https://stackoverflow.com/a/76808361)."
default = false
}
variable "network_interface_id" {
type = string
description = "The ID of the network interface to attach. If specified, all the other network_interface block arguments are ignored."
default = null
}
variable "user_data_base64" {
type = string
description = "The Base64-encoded user data to provide when launching the instances"
default = ""
}
variable "enable_monitoring" {
type = bool
description = "Enable/disable detailed monitoring"
default = true
}
variable "update_default_version" {
type = bool
description = "Whether to update Default version of Launch template each update"
default = false
}
variable "ebs_optimized" {
type = bool
description = "If true, the launched EC2 instance will be EBS-optimized"
default = false
}
variable "block_device_mappings" {
description = "Specify volumes to attach to the instance besides the volumes specified by the AMI"
type = list(object({
device_name = optional(string)
no_device = optional(bool)
virtual_name = optional(string)
ebs = object({
delete_on_termination = optional(bool)
encrypted = optional(bool)
iops = optional(number)
throughput = optional(number)
kms_key_id = optional(string)
snapshot_id = optional(string)
volume_size = optional(number)
volume_type = optional(string)
})
}))
default = []
}
variable "instance_market_options" {
description = "The market (purchasing) option for the instances"
type = object({
market_type = string
spot_options = optional(object({
block_duration_minutes = optional(number)
instance_interruption_behavior = optional(string)
max_price = optional(number)
spot_instance_type = optional(string)
valid_until = optional(string)
}))
})
default = null
}
variable "instance_refresh" {
description = "The instance refresh definition"
type = object({
strategy = string
preferences = optional(object({
instance_warmup = optional(number, null)
min_healthy_percentage = optional(number, null)
skip_matching = optional(bool, null)
auto_rollback = optional(bool, null)
scale_in_protected_instances = optional(string, null)
standby_instances = optional(string, null)
}), null)
triggers = optional(list(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 = optional(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 = optional(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 "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" {
type = list(string)
description = "A list of subnet IDs to launch resources in"
}
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 names. 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_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 scaling policy type. Currently only `SimpleScaling` is supported"
}
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 scaling policy type. Currently only `SimpleScaling` is supported"
}
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 "desired_capacity" {
type = number
description = "The number of Amazon EC2 instances that should be running in the group, if not set will use `min_size` as value"
default = null
}
variable "default_alarms_enabled" {
type = bool
default = true
description = "Enable or disable cpu and memory Cloudwatch alarms"
}
variable "custom_alarms" {
type = map(object({
alarm_name = string
comparison_operator = string
evaluation_periods = string
metric_name = string
namespace = string
period = string
statistic = string
extended_statistic = string
threshold = string
treat_missing_data = string
ok_actions = list(string)
insufficient_data_actions = list(string)
dimensions_name = string
dimensions_target = string
alarm_description = string
alarm_actions = list(string)
}))
default = {}
description = "Map of custom CloudWatch alarms configurations"
}
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 "metadata_http_protocol_ipv6_enabled" {
type = bool
default = false
description = "Set true to enable IPv6 in the launch template."
}
variable "metadata_instance_metadata_tags_enabled" {
type = bool
default = false
description = "Set true to enable metadata tags in the launch template."
}
variable "tag_specifications_resource_types" {
type = set(string)
default = ["instance", "volume"]
description = "List of tag specification resource types to tag. Valid values are instance, volume, elastic-gpu and spot-instances-request."
}
variable "max_instance_lifetime" {
type = number
default = null
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"
}
variable "capacity_rebalance" {
type = bool
default = false
description = "Indicates whether capacity rebalance is enabled. Otherwise, capacity rebalance is disabled."
}
variable "warm_pool" {
type = object({
pool_state = string
min_size = number
max_group_prepared_capacity = number
})
description = "If this block is configured, add a Warm Pool to the specified Auto Scaling group. See [warm_pool](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group#warm_pool)."
default = null
}
variable "instance_reuse_policy" {
type = object({
reuse_on_scale_in = bool
})
description = "If warm pool and this block are configured, instances in the Auto Scaling group can be returned to the warm pool on scale in. The default is to terminate instances in the Auto Scaling group when the group scales in."
default = null
}