forked from terraform-aws-modules/terraform-aws-ecs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
673 lines (561 loc) · 20.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
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
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
variable "create" {
description = "Determines whether resources will be created (affects all resources)"
type = bool
default = true
}
variable "create_service" {
description = "Determines whether service resource will be created (set to `false` in case you want to create task definition only)"
type = bool
default = true
}
variable "tags" {
description = "A map of tags to add to all resources"
type = map(string)
default = {}
}
################################################################################
# Service
################################################################################
variable "ignore_task_definition_changes" {
description = "Whether changes to service `task_definition` changes should be ignored"
type = bool
default = false
}
variable "alarms" {
description = "Information about the CloudWatch alarms"
type = any
default = {}
}
variable "capacity_provider_strategy" {
description = "Capacity provider strategies to use for the service. Can be one or more"
type = any
default = {}
}
variable "cluster_arn" {
description = "ARN of the ECS cluster where the resources will be provisioned"
type = string
default = ""
}
variable "deployment_circuit_breaker" {
description = "Configuration block for deployment circuit breaker"
type = any
default = {}
}
variable "deployment_controller" {
description = "Configuration block for deployment controller configuration"
type = any
default = {}
}
variable "deployment_maximum_percent" {
description = "Upper limit (as a percentage of the service's `desired_count`) of the number of running tasks that can be running in a service during a deployment"
type = number
default = 200
}
variable "deployment_minimum_healthy_percent" {
description = "Lower limit (as a percentage of the service's `desired_count`) of the number of running tasks that must remain running and healthy in a service during a deployment"
type = number
default = 66
}
variable "desired_count" {
description = "Number of instances of the task definition to place and keep running"
type = number
default = 1
}
variable "enable_ecs_managed_tags" {
description = "Specifies whether to enable Amazon ECS managed tags for the tasks within the service"
type = bool
default = true
}
variable "enable_execute_command" {
description = "Specifies whether to enable Amazon ECS Exec for the tasks within the service"
type = bool
default = false
}
variable "force_new_deployment" {
description = "Enable to force a new task deployment of the service. This can be used to update tasks to use a newer Docker image with same image/tag combination, roll Fargate tasks onto a newer platform version, or immediately deploy `ordered_placement_strategy` and `placement_constraints` updates"
type = bool
default = true
}
variable "health_check_grace_period_seconds" {
description = "Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 2147483647. Only valid for services configured to use load balancers"
type = number
default = null
}
variable "launch_type" {
description = "Launch type on which to run your service. The valid values are `EC2`, `FARGATE`, and `EXTERNAL`. Defaults to `FARGATE`"
type = string
default = "FARGATE"
}
variable "load_balancer" {
description = "Configuration block for load balancers"
type = any
default = {}
}
variable "name" {
description = "Name of the service (up to 255 letters, numbers, hyphens, and underscores)"
type = string
default = null
}
variable "assign_public_ip" {
description = "Assign a public IP address to the ENI (Fargate launch type only)"
type = bool
default = false
}
variable "security_group_ids" {
description = "List of security groups to associate with the task or service"
type = list(string)
default = []
}
variable "subnet_ids" {
description = "List of subnets to associate with the task or service"
type = list(string)
default = []
}
variable "ordered_placement_strategy" {
description = "Service level strategy rules that are taken into consideration during task placement. List from top to bottom in order of precedence"
type = any
default = {}
}
variable "placement_constraints" {
description = "Configuration block for rules that are taken into consideration during task placement (up to max of 10). This is set at the service, see `task_definition_placement_constraints` for setting at the task definition"
type = any
default = {}
}
variable "platform_version" {
description = "Platform version on which to run your service. Only applicable for `launch_type` set to `FARGATE`. Defaults to `LATEST`"
type = string
default = null
}
variable "propagate_tags" {
description = "Specifies whether to propagate the tags from the task definition or the service to the tasks. The valid values are `SERVICE` and `TASK_DEFINITION`"
type = string
default = null
}
variable "scheduling_strategy" {
description = "Scheduling strategy to use for the service. The valid values are `REPLICA` and `DAEMON`. Defaults to `REPLICA`"
type = string
default = null
}
variable "service_connect_configuration" {
description = "The ECS Service Connect configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace"
type = any
default = {}
}
variable "service_registries" {
description = "Service discovery registries for the service"
type = any
default = {}
}
variable "timeouts" {
description = "Create, update, and delete timeout configurations for the service"
type = map(string)
default = {}
}
variable "triggers" {
description = "Map of arbitrary keys and values that, when changed, will trigger an in-place update (redeployment). Useful with `timestamp()`"
type = any
default = {}
}
variable "wait_for_steady_state" {
description = "If true, Terraform will wait for the service to reach a steady state before continuing. Default is `false`"
type = bool
default = null
}
variable "service_tags" {
description = "A map of additional tags to add to the service"
type = map(string)
default = {}
}
################################################################################
# Service - IAM Role
################################################################################
variable "create_iam_role" {
description = "Determines whether the ECS service IAM role should be created"
type = bool
default = true
}
variable "iam_role_arn" {
description = "Existing IAM role ARN"
type = string
default = null
}
variable "iam_role_name" {
description = "Name to use on IAM role created"
type = string
default = null
}
variable "iam_role_use_name_prefix" {
description = "Determines whether the IAM role name (`iam_role_name`) is used as a prefix"
type = bool
default = true
}
variable "iam_role_path" {
description = "IAM role path"
type = string
default = null
}
variable "iam_role_description" {
description = "Description of the role"
type = string
default = null
}
variable "iam_role_permissions_boundary" {
description = "ARN of the policy that is used to set the permissions boundary for the IAM role"
type = string
default = null
}
variable "iam_role_tags" {
description = "A map of additional tags to add to the IAM role created"
type = map(string)
default = {}
}
variable "iam_role_statements" {
description = "A map of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage"
type = any
default = {}
}
################################################################################
# Task Definition
################################################################################
variable "create_task_definition" {
description = "Determines whether to create a task definition or use existing/provided"
type = bool
default = true
}
variable "task_definition_arn" {
description = "Existing task definition ARN. Required when `create_task_definition` is `false`"
type = string
default = null
}
variable "container_definitions" {
description = "A map of valid [container definitions](http://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html). Please note that you should only provide values that are part of the container definition document"
type = any
default = {}
}
variable "container_definition_defaults" {
description = "A map of default values for [container definitions](http://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html) created by `container_definitions`"
type = any
default = {}
}
variable "cpu" {
description = "Number of cpu units used by the task. If the `requires_compatibilities` is `FARGATE` this field is required"
type = number
default = 1024
}
variable "ephemeral_storage" {
description = "The amount of ephemeral storage to allocate for the task. This parameter is used to expand the total amount of ephemeral storage available, beyond the default amount, for tasks hosted on AWS Fargate"
type = any
default = {}
}
variable "family" {
description = "A unique name for your task definition"
type = string
default = null
}
variable "inference_accelerator" {
description = "Configuration block(s) with Inference Accelerators settings"
type = any
default = {}
}
variable "ipc_mode" {
description = "IPC resource namespace to be used for the containers in the task The valid values are `host`, `task`, and `none`"
type = string
default = null
}
variable "memory" {
description = "Amount (in MiB) of memory used by the task. If the `requires_compatibilities` is `FARGATE` this field is required"
type = number
default = 2048
}
variable "network_mode" {
description = "Docker networking mode to use for the containers in the task. Valid values are `none`, `bridge`, `awsvpc`, and `host`"
type = string
default = "awsvpc"
}
variable "pid_mode" {
description = "Process namespace to use for the containers in the task. The valid values are `host` and `task`"
type = string
default = null
}
variable "task_definition_placement_constraints" {
description = "Configuration block for rules that are taken into consideration during task placement (up to max of 10). This is set at the task definition, see `placement_constraints` for setting at the service"
type = any
default = {}
}
variable "proxy_configuration" {
description = "Configuration block for the App Mesh proxy"
type = any
default = {}
}
variable "requires_compatibilities" {
description = "Set of launch types required by the task. The valid values are `EC2` and `FARGATE`"
type = list(string)
default = ["FARGATE"]
}
variable "runtime_platform" {
description = "Configuration block for `runtime_platform` that containers in your task may use"
type = any
default = {
operating_system_family = "LINUX"
cpu_architecture = "X86_64"
}
}
variable "skip_destroy" {
description = "If true, the task is not deleted when the service is deleted"
type = bool
default = null
}
variable "volume" {
description = "Configuration block for volumes that containers in your task may use"
type = any
default = {}
}
variable "task_tags" {
description = "A map of additional tags to add to the task definition/set created"
type = map(string)
default = {}
}
################################################################################
# Task Execution - IAM Role
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html
################################################################################
variable "create_task_exec_iam_role" {
description = "Determines whether the ECS task definition IAM role should be created"
type = bool
default = true
}
variable "task_exec_iam_role_arn" {
description = "Existing IAM role ARN"
type = string
default = null
}
variable "task_exec_iam_role_name" {
description = "Name to use on IAM role created"
type = string
default = null
}
variable "task_exec_iam_role_use_name_prefix" {
description = "Determines whether the IAM role name (`task_exec_iam_role_name`) is used as a prefix"
type = bool
default = true
}
variable "task_exec_iam_role_path" {
description = "IAM role path"
type = string
default = null
}
variable "task_exec_iam_role_description" {
description = "Description of the role"
type = string
default = null
}
variable "task_exec_iam_role_permissions_boundary" {
description = "ARN of the policy that is used to set the permissions boundary for the IAM role"
type = string
default = null
}
variable "task_exec_iam_role_tags" {
description = "A map of additional tags to add to the IAM role created"
type = map(string)
default = {}
}
variable "task_exec_iam_role_policies" {
description = "Map of IAM role policy ARNs to attach to the IAM role"
type = map(string)
default = {}
}
variable "task_exec_iam_role_max_session_duration" {
description = "Maximum session duration (in seconds) for ECS task execution role. Default is 3600."
type = number
default = null
}
variable "create_task_exec_policy" {
description = "Determines whether the ECS task definition IAM policy should be created. This includes permissions included in AmazonECSTaskExecutionRolePolicy as well as access to secrets and SSM parameters"
type = bool
default = true
}
variable "task_exec_ssm_param_arns" {
description = "List of SSM parameter ARNs the task execution role will be permitted to get/read"
type = list(string)
default = ["arn:aws:ssm:*:*:parameter/*"]
}
variable "task_exec_secret_arns" {
description = "List of SecretsManager secret ARNs the task execution role will be permitted to get/read"
type = list(string)
default = ["arn:aws:secretsmanager:*:*:secret:*"]
}
variable "task_exec_iam_statements" {
description = "A map of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage"
type = any
default = {}
}
variable "task_exec_iam_policy_path" {
description = "Path for the iam role"
type = string
default = null
}
################################################################################
# Tasks - IAM role
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html
################################################################################
variable "create_tasks_iam_role" {
description = "Determines whether the ECS tasks IAM role should be created"
type = bool
default = true
}
variable "tasks_iam_role_arn" {
description = "Existing IAM role ARN"
type = string
default = null
}
variable "tasks_iam_role_name" {
description = "Name to use on IAM role created"
type = string
default = null
}
variable "tasks_iam_role_use_name_prefix" {
description = "Determines whether the IAM role name (`tasks_iam_role_name`) is used as a prefix"
type = bool
default = true
}
variable "tasks_iam_role_path" {
description = "IAM role path"
type = string
default = null
}
variable "tasks_iam_role_description" {
description = "Description of the role"
type = string
default = null
}
variable "tasks_iam_role_permissions_boundary" {
description = "ARN of the policy that is used to set the permissions boundary for the IAM role"
type = string
default = null
}
variable "tasks_iam_role_tags" {
description = "A map of additional tags to add to the IAM role created"
type = map(string)
default = {}
}
variable "tasks_iam_role_policies" {
description = "Map of IAM role policy ARNs to attach to the IAM role"
type = map(string)
default = {}
}
variable "tasks_iam_role_statements" {
description = "A map of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage"
type = any
default = {}
}
variable "tasks_iam_policy_path" {
description = "Path for the tasks iam policy"
type = string
default = null
}
################################################################################
# Task Set
################################################################################
variable "external_id" {
description = "The external ID associated with the task set"
type = string
default = null
}
variable "scale" {
description = "A floating-point percentage of the desired number of tasks to place and keep running in the task set"
type = any
default = {}
}
variable "force_delete" {
description = "Whether to allow deleting the task set without waiting for scaling down to 0"
type = bool
default = null
}
variable "wait_until_stable" {
description = "Whether terraform should wait until the task set has reached `STEADY_STATE`"
type = bool
default = null
}
variable "wait_until_stable_timeout" {
description = "Wait timeout for task set to reach `STEADY_STATE`. Valid time units include `ns`, `us` (or µs), `ms`, `s`, `m`, and `h`. Default `10m`"
type = string
default = null
}
################################################################################
# Autoscaling
################################################################################
variable "enable_autoscaling" {
description = "Determines whether to enable autoscaling for the service"
type = bool
default = true
}
variable "autoscaling_min_capacity" {
description = "Minimum number of tasks to run in your service"
type = number
default = 1
}
variable "autoscaling_max_capacity" {
description = "Maximum number of tasks to run in your service"
type = number
default = 10
}
variable "autoscaling_policies" {
description = "Map of autoscaling policies to create for the service"
type = any
default = {
cpu = {
policy_type = "TargetTrackingScaling"
target_tracking_scaling_policy_configuration = {
predefined_metric_specification = {
predefined_metric_type = "ECSServiceAverageCPUUtilization"
}
}
}
memory = {
policy_type = "TargetTrackingScaling"
target_tracking_scaling_policy_configuration = {
predefined_metric_specification = {
predefined_metric_type = "ECSServiceAverageMemoryUtilization"
}
}
}
}
}
variable "autoscaling_scheduled_actions" {
description = "Map of autoscaling scheduled actions to create for the service"
type = any
default = {}
}
################################################################################
# Security Group
################################################################################
variable "create_security_group" {
description = "Determines if a security group is created"
type = bool
default = true
}
variable "security_group_name" {
description = "Name to use on security group created"
type = string
default = null
}
variable "security_group_use_name_prefix" {
description = "Determines whether the security group name (`security_group_name`) is used as a prefix"
type = bool
default = true
}
variable "security_group_description" {
description = "Description of the security group created"
type = string
default = null
}
variable "security_group_rules" {
description = "Security group rules to add to the security group created"
type = any
default = {}
}
variable "security_group_tags" {
description = "A map of additional tags to add to the security group created"
type = map(string)
default = {}
}