-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvariables.tf
288 lines (249 loc) · 10.2 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
/* -------------------------------------------------------------------------- */
/* Generic */
/* -------------------------------------------------------------------------- */
variable "name_override" {
description = "(Optional) Full name to override usage from format(\"%s-%s-%s-cf\", var.prefix, var.environment, var.name)"
type = string
default = ""
}
variable "prefix" {
description = "(Optional) Prefix as a part of format(\"%s-%s-%s-cf\", var.prefix, var.environment, var.name); ex. oozou-xxx-xxx-cf"
type = string
default = ""
}
variable "environment" {
description = "(Optional) Environment as a part of format(\"%s-%s-%s-cf\", var.prefix, var.environment, var.name); ex. xxx-prod-xxx-cf"
type = string
default = ""
}
variable "name" {
description = "(Optional) Name as a part of format(\"%s-%s-%s-cf\", var.prefix, var.environment, var.name); ex. xxx-xxx-cms-cf"
type = string
default = ""
}
variable "tags" {
description = "Custom tags which can be passed on to the AWS resources. They should be key value pairs having distinct keys"
type = map(any)
default = {}
}
/* -------------------------------------------------------------------------- */
/* Role */
/* -------------------------------------------------------------------------- */
variable "is_create_iam_role" {
description = "Create the built in IAM role for task role and task exec role"
type = bool
default = true
}
/* -------------------------------------------------------------------------- */
/* Task Role */
/* -------------------------------------------------------------------------- */
variable "exists_task_role_arn" {
description = "The existing arn of task role"
type = string
default = ""
}
variable "additional_ecs_task_role_policy_arns" {
description = "List of policies ARNs to attach to the ECS Task Role. eg: { rds_arn = module.postgres_db.rds_policy_arn }"
type = list(string)
default = []
}
/* -------------------------------------------------------------------------- */
/* Task Exec Role */
/* -------------------------------------------------------------------------- */
variable "exists_task_execution_role_arn" {
description = "The existing arn of task exec role"
type = string
default = ""
}
variable "additional_ecs_task_execution_role_policy_arns" {
description = "List of policies ARNs to attach to the ECS Task Role. eg: { rds_arn = module.postgres_db.rds_policy_arn }"
type = list(string)
default = []
}
/* -------------------------------------------------------------------------- */
/* CloudWatch Log Group */
/* -------------------------------------------------------------------------- */
variable "is_create_cloudwatch_log_group" {
description = "Whether to create cloudwatch log group or not"
type = bool
default = true
}
variable "is_create_default_kms" {
description = "Whether to create cloudwatch log group kms or not"
type = bool
default = true
}
variable "cloudwatch_log_retention_in_days" {
description = "Retention day for cloudwatch log group"
type = number
default = 90
}
variable "cloudwatch_log_group_kms_key_arn" {
description = "The ARN for the KMS encryption key."
type = string
default = null
}
/* -------------------------------------------------------------------------- */
/* LoadBalancer */
/* -------------------------------------------------------------------------- */
variable "target_group_deregistration_delay" {
description = "(Optional) Amount time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds."
type = number
default = 300
}
variable "vpc_id" {
description = "VPC id where security group is created"
type = string
default = ""
}
/* ------------------------------ Listener Rule ----------------------------- */
variable "alb_listener_arn" {
description = "The ALB listener to attach to"
type = string
default = ""
}
variable "alb_target_group" {
description = "Target group for application"
type = any
default = {}
}
variable "alb_listener_rules" {
description = "Listener rule to add to listener arn"
type = list(any)
default = []
}
variable "custom_header_token" {
description = "[Required] Specify secret value for custom header"
type = string
default = ""
}
variable "slow_start" {
description = "(Optional) Amount time for TargetGroup wait before check the farget-service. The range 30-900 seconds or 0 to disable. Not compatible with the Least outstanding requests and Weighted random routing algorithms. The default value is 0 seconds."
type = number
default = 0
}
/* -------------------------------------------------------------------------- */
/* Secret & Env */
/* -------------------------------------------------------------------------- */
variable "secret_variables" {
description = "Map of secret name(as reflected in Secrets Manager) and secret JSON string associated"
type = map(map(any))
default = {}
}
variable "environment_variables" {
description = "Map of environment varaibles ex. { RDS_ENDPOINT = \"admin@rds@123\"}"
type = map(map(any))
default = {}
}
/* -------------------------------------------------------------------------- */
/* Task Definition */
/* -------------------------------------------------------------------------- */
variable "task_cpu" {
description = "(Require): cpu for task level"
type = number
}
variable "task_memory" {
description = "(Require): memory for task level"
type = number
}
variable "is_application_scratch_volume_enabled" {
description = "To enabled the temporary storage for the service"
type = bool
default = false
}
/* -------------------------------------------------------------------------- */
/* Fargate Service */
/* -------------------------------------------------------------------------- */
variable "ecs_cluster_name" {
description = "ECS Cluster name to deploy in"
type = string
}
variable "service_discovery_namespace" {
description = "DNS Namespace to deploy to"
type = string
}
variable "service_count" {
description = "Number of containers to deploy"
type = number
default = 1
}
variable "is_enable_execute_command" {
description = "Specifies whether to enable Amazon ECS Exec for the tasks within the service."
type = bool
default = false
}
variable "application_subnet_ids" {
description = "Subnet IDs to deploy into"
type = list(string)
}
variable "security_groups" {
description = "Security groups to apply to service"
type = list(string)
}
variable "propagate_tags" {
description = "(Optional) 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 = "TASK_DEFINITION"
}
/* -------------------------------------------------------------------------- */
/* Auto Scaling Group */
/* -------------------------------------------------------------------------- */
variable "step_scaling_configuration" {
description = "(optional) Define step scaling behaviour, example in README"
type = any
default = {}
}
variable "target_tracking_configuration" {
description = "(optional) Define traget tracking behaviour, example in README"
type = any
default = {}
}
/* -------------------------------------------------------------------------- */
/* capacity provider strategy */
/* -------------------------------------------------------------------------- */
variable "capacity_provider_strategy" {
description = "Capacity provider strategies to use for the service EC2 Autoscaling group"
type = map(any)
default = null
}
variable "ordered_placement_strategy" {
description = "Service level strategy rules that are taken into consideration during task placement"
type = set(object({
type = string
field = string
}))
default = [{
type = "spread"
field = "attribute:ecs.availability-zone"
}]
}
/* -------------------------------------------------------------------------- */
/* volume */
/* -------------------------------------------------------------------------- */
variable "efs_volumes" {
description = "Task EFS volume definitions as list of configuration objects. You cannot define both Docker volumes and EFS volumes on the same task definition."
type = list(any)
default = []
}
/* -------------------------------------------------------------------------- */
/* Rollback */
/* -------------------------------------------------------------------------- */
variable "deployment_circuit_breaker" {
description = "Configuration block for deployment circuit breaker"
type = object({
enable = bool
rollback = bool
})
default = {
enable = true
rollback = true
}
}
/* -------------------------------------------------------------------------- */
/* NEW TASK DEF */
/* -------------------------------------------------------------------------- */
variable "container" {
description = "The container(s) that would be rendered in task definition; see example for completion"
type = any
default = {}
}