-
Notifications
You must be signed in to change notification settings - Fork 2
/
variables.tf
202 lines (168 loc) · 6.27 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
variable "name" {
description = "The name of the service. Used as a prefix for other resource names"
}
variable "cluster_id" {
description = <<EOF
The id of the ECS cluster this service belongs to.
Having multiple related services in one service can decrease cost
by more efficiently using a shared pool of resources.
EOF
}
variable "cluster_name" {
type = string
description = "The name of the ECS cluster this service will run in."
}
variable "desired_count" {
type = number
description = "If not using Application Auto-scaling, the number of tasks to keep alive at all times"
default = null
}
variable "use_autoscaling" {
type = bool
description = "Use Application Auto-scaling to scale service"
default = false
}
variable "min_desired_count" {
type = number
description = "If using Application auto-scaling, minimum number of tasks to keep alive at all times"
default = null
}
variable "max_desired_count" {
type = number
description = "If using Application auto-scaling, maximum number of tasks to keep alive at all times"
default = null
}
variable "scaling_target_value" {
type = number
description = "If using Application auto-scaling, the target value to hit for the Auto-scaling policy"
default = null
}
variable "scaling_metric" {
type = string
description = "If using Application auto-scaling, the pre-defined AWS metric to use for the Auto-scaling policy"
default = "ALBRequestCountPerTarget"
}
variable "alb_scaling_target_resource_id" {
type = string
description = "If using Application auto-scaling, and ALBRequestCountPerTarget as the scaling metric, use this resource ID as the measure"
default = ""
}
variable "vpc_id" {
description = "ID of the VPC the alb is in"
}
variable "subnet_ids" {
type = list(string)
description = "List of subnets tasks can be run in."
}
variable "load_balancers" {
type = list(object({
target_group_arn = string
container_name = string
container_port = string
security_groups = optional(list(string))
cidr_blocks = optional(list(string))
}))
default = []
description = <<EOF
When using ECS services, the service will ensure that at least
{@variable desired_count} tasks are running at all times. Because
there can be multiple tasks running at once, we set up a load
balancer to ditribute traffic.
`target_group_arn` is the arn of the target group on that alb that will
be set to watch over the tasks managed by this service.
EOF
}
variable "service_registries" {
description = "Allows you to register this service to a Cloud Map registry"
type = list(map(string))
default = []
}
variable "tags" {
type = map(string)
description = "Tags to set on all resources that support them"
}
variable "cpu" {
default = 512
description = "How much CPU should be allocated to each app instance?"
}
variable "memory" {
default = 1024
description = "How much memory should be allocated to each app instance?"
}
variable "container_definitions" {
type = string
description = "JSON encoded list of container definitions"
}
variable "additional_task_policy_arns" {
type = list(string)
description = "IAM Policy arns to be added to the tasks"
default = []
}
variable "additional_task_policy_arns_count" {
type = number
description = "The number of items in var.additional_task_policy_arns. Terraform is not quite smart enough to figure this out on its own."
default = 0
}
variable "health_check_grace_period_seconds" {
type = number
default = 60
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."
}
variable "alb_security_group_ids" {
type = list(string)
description = "The ids of all security groups set on the ALB. We require that the tasks can only talk to the ALB. If using an NLB, use ingress_cidr_blocks instead"
default = null
}
variable "ingress_cidr_blocks" {
type = list(string)
description = "CIDR blocks to allow accessing the ECS tasks. This is usually not specified, as the alb_security_group_ids covers the ingress, but in some cases is useful if using an NLB instead of an ALB, which cannot attach security groups to itself."
default = null
}
variable "execution_role_arn" {
type = string
description = "If present, this is the execution role that will be used for the ECS Tasks. If not present, a role will be created"
default = ""
}
variable "security_group_id" {
type = string
description = "If present, this is the security group to apply to the ECS task. If not present, a security group will be created"
default = ""
}
variable "volumes" {
type = list(map(string))
description = "List of volumes to make available to containers in this task."
default = []
}
variable "deploy_env" {
type = string
description = "The environment resources are to be created in. Usually dev, staging, or prod"
}
variable "aws_region" {
type = string
description = "The AWS region to create resources in."
default = "eu-west-1"
}
variable "capacity_provider_strategies" {
type = list(object({
base = optional(number)
capacity_provider = string
weight = number
}))
default = []
description = <<EOF
Capacity provider strategy to use for the service
base - Number of tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined.
capacity_provider - Short name of the capacity provider
weight - Relative percentage of the total number of launched tasks that should use the specified capacity provider
EOF
}
variable "ephemeral_storage_gib" {
description = "The total amount, in GiB, of ephemeral storage to set for the task. The minimum supported value is 21 GiB and the maximum supported value is 200 GiB."
type = number
default = 21
}
variable "enable_execute_command" {
description = "Specifies whether to enable Amazon ECS Exec for the tasks within the service."
type = bool
default = false
}