-
Notifications
You must be signed in to change notification settings - Fork 4
/
variables.tf
472 lines (393 loc) · 15.3 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
#Module : LABEL
#Description : Terraform label module variables.
variable "name" {
type = string
default = ""
description = "Name (e.g. `app` or `cluster`)."
}
variable "repository" {
type = string
default = "https://github.com/clouddrove/terraform-aws-ec2-autoscaling"
description = "Terraform current module repo"
}
variable "environment" {
type = string
default = ""
description = "Environment (e.g. `prod`, `dev`, `staging`)."
}
variable "label_order" {
type = list(any)
default = ["environment", "name"]
description = "Label order, e.g. `name`,`application`."
}
variable "tags" {
type = map(any)
default = {}
description = "Additional tags (e.g. map(`BusinessUnit`,`XYZ`)."
}
variable "managedby" {
type = string
default = "anmol@clouddrove.com"
description = "ManagedBy, eg 'CloudDrove' or 'AnmolNagpal'."
}
variable "delimiter" {
type = string
default = "-"
description = "Delimiter to be used between `organization`, `environment`, `name` and `attributes`."
}
variable "enabled" {
type = bool
default = true
description = "Whether to create the resources. Set to `false` to prevent the module from creating any resources."
}
variable "image_id" {
type = string
default = ""
description = "The EC2 image ID to launch."
}
variable "instance_initiated_shutdown_behavior" {
type = string
default = "terminate"
description = "Shutdown behavior for the instances. Can be `stop` or `terminate`."
}
variable "instance_type" {
type = string
default = "t2.nano"
description = "Instance type to launch."
}
variable "iam_instance_profile_name" {
type = string
default = null
description = "The IAM instance profile name to associate with launched instances."
}
variable "key_name" {
type = string
default = ""
description = "The SSH key name that should be used for the instance."
}
variable "security_group_ids" {
type = list(string)
default = []
description = "A list of associated security group IDs."
}
variable "associate_public_ip_address" {
type = bool
default = false
description = "Associate a public IP address with an instance in a VPC."
}
variable "instance_profile_enabled" {
type = bool
default = true
description = "Associate a public IP address with an instance in a VPC."
}
variable "user_data_base64" {
type = string
default = ""
description = "The Base64-encoded user data to provide when launching the instances."
}
variable "enable_monitoring" {
type = bool
default = true
description = "Enable/disable detailed monitoring."
}
variable "max_size" {
type = number
default = 3
description = "The maximum size of the autoscale group."
}
variable "min_size" {
type = number
default = 1
description = "The minimum size of the autoscale group."
}
variable "max_size_scaleup" {
type = number
default = 3
description = "The maximum size of the autoscale group."
}
variable "min_size_scaleup" {
type = number
default = 1
description = "The minimum size of the autoscale group."
}
variable "subnet_ids" {
type = list(string)
default = []
description = "A list of subnet IDs to launch resources in."
}
variable "default_cooldown" {
type = number
default = 150
description = "The amount of time, in seconds, after a scaling activity completes before another scaling activity can start."
}
variable "health_check_grace_period" {
type = number
default = 300
description = "Time (in seconds) after instance comes into service before checking health."
}
variable "health_check_type" {
type = string
default = "EC2"
description = "Controls how health checking is done. Valid values are `EC2` or `ELB`."
}
variable "force_delete" {
type = bool
default = false
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."
}
variable "load_balancers" {
type = list(string)
default = []
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."
}
variable "target_group_arns" {
type = list(string)
default = []
description = "A list of aws_alb_target_group ARNs, for use with Application Load Balancing."
}
variable "termination_policies" {
type = list(string)
default = ["Default"]
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`."
}
variable "suspended_processes" {
type = list(string)
default = []
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."
}
variable "metrics_granularity" {
type = string
default = "1Minute"
description = "The granularity to associate with the metrics to collect. The only valid value is 1Minute."
}
variable "enabled_metrics" {
type = list(string)
default = ["GroupMinSize", "GroupMaxSize", "GroupDesiredCapacity", "GroupInServiceInstances", "GroupPendingInstances", "GroupStandbyInstances", "GroupTerminatingInstances", "GroupTotalInstances"]
description = "A list of metrics to collect. The allowed values are `GroupMinSize`, `GroupMaxSize`, `GroupDesiredCapacity`, `GroupInServiceInstances`, `GroupPendingInstances`, `GroupStandbyInstances`, `GroupTerminatingInstances`, `GroupTotalInstances`."
}
variable "wait_for_capacity_timeout" {
type = string
default = "15m"
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."
}
variable "min_elb_capacity" {
type = number
default = null
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."
}
variable "protect_from_scale_in" {
type = bool
default = false
description = "Allows setting instance protection. The autoscaling group will not select instances with this setting for terminination during scale in events."
}
variable "service_linked_role_arn" {
type = string
default = ""
description = "The ARN of the service-linked role that the ASG will use to call other AWS services."
}
variable "on_demand_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 = 150
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 = 200
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 "volume_size" {
type = number
default = 100
description = "The size of ebs volume."
}
variable "volume_type" {
type = string
default = "standard"
description = "The type of volume. Can be `standard`, `gp2`, or `io1`. (Default: `standard`)."
}
variable "ebs_encryption" {
type = bool
default = false
description = "Enables EBS encryption on the volume (Default: false). Cannot be used with snapshot_id."
}
variable "kms_key_arn" {
type = string
default = ""
description = "AWS Key Management Service (AWS KMS) customer master key (CMK) to use when creating the encrypted volume. encrypted must be set to true when this is set."
}
###Spot
variable "spot_enabled" {
type = bool
default = false
description = "Whether to create the spot instance. Set to `false` to prevent the module from creating any spot instances."
}
variable "instance_interruption_behavior" {
type = string
default = "terminate"
description = "The behavior when a Spot Instance is interrupted. Can be hibernate, stop, or terminate. (Default: terminate)."
}
variable "max_price" {
type = string
default = ""
description = "The maximum hourly price you're willing to pay for the Spot Instances."
}
variable "spot_instance_type" {
type = string
default = "t2.medium"
description = "Sport instance type to launch."
}
variable "spot_max_size" {
type = number
default = "1"
description = "The maximum size of the spot autoscale group."
}
variable "spot_min_size" {
type = number
default = "1"
description = "The minimum size of the spot autoscale group."
}
variable "scheduler_down" {
type = string
default = "0 19 * * MON-FRI" # 21:00 CET
description = "What is the recurrency for scaling up operations ?"
}
variable "scheduler_up" {
type = string
default = "0 6 * * MON-FRI" # 07:00 CET
description = "What is the recurrency for scaling down operations ?"
}
variable "min_size_scaledown" {
type = number
default = 0
description = "The minimum size for the Auto Scaling group. Default 0. Set to -1 if you don't want to change the minimum size at the scheduled time."
}
variable "max_size_scaledown" {
type = number
default = 1
description = "The maximum size for the Auto Scaling group. Default 0. Set to -1 if you don't want to change the minimum size at the scheduled time."
}
variable "spot_min_size_scaledown" {
type = number
default = 0
description = "The minimum size for the Auto Scaling group of spot instances. Default 0. Set to -1 if you don't want to change the minimum size at the scheduled time."
}
variable "spot_max_size_scaledown" {
type = number
default = 1
description = "The maximum size for the Auto Scaling group of spot instances. Default 0. Set to -1 if you don't want to change the minimum size at the scheduled time."
}
variable "scale_down_desired" {
type = number
default = 0
description = " The number of Amazon EC2 instances that should be running in the group."
}
variable "spot_scale_down_desired" {
type = number
default = 0
description = " The number of Amazon EC2 instances that should be running in the group."
}
variable "scale_up_desired" {
type = number
default = 0
description = " The number of Amazon EC2 instances that should be running in the group."
}
variable "spot_scale_up_desired" {
type = number
default = 0
description = " The number of Amazon EC2 instances that should be running in the group."
}
variable "schedule_enabled" {
type = bool
default = false
description = "AutoScaling Schedule resource"
}
variable "spot_schedule_enabled" {
type = bool
default = false
description = "AutoScaling Schedule resource for spot"
}
variable "desired_capacity" {
type = number
default = 3
description = "The number of Amazon EC2 instances that should be running in the group."
}
variable "spot_desired_capacity" {
type = number
default = 3
description = "The number of Amazon EC2 instances that should be running in the group."
}