-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathvariables.tf
452 lines (379 loc) · 13.5 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
#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-alb"
description = "Terraform current module repo"
validation {
# regex(...) fails if it cannot find a match
condition = can(regex("^https://", var.repository))
error_message = "The module-repo value must be a valid Git repo link."
}
}
variable "environment" {
type = string
default = "test"
description = "Environment (e.g. `prod`, `dev`, `staging`)."
}
variable "label_order" {
type = list(any)
default = ["name", "environment"]
description = "Label order, e.g. `name`,`application`."
}
variable "managedby" {
type = string
default = "[email protected]"
description = "ManagedBy, eg 'CloudDrove'."
}
# Module : ALB
# Description : Terraform ALB module variables.
variable "instance_count" {
type = number
default = 0
description = "The count of instances."
}
variable "internal" {
type = string
default = ""
description = "If true, the LB will be internal."
}
variable "load_balancer_type" {
type = string
default = ""
description = "The type of load balancer to create. Possible values are application or network. The default value is application."
}
variable "subnet_mapping" {
default = []
type = list(map(string))
description = "A list of subnet mapping blocks describing subnets to attach to network load balancer"
}
variable "https_listeners" {
type = list(map(string))
default = []
description = "A list of maps describing the HTTPS listeners for this ALB. Required key/values: port, certificate_arn. Optional key/values: ssl_policy (defaults to ELBSecurityPolicy-2016-08), target_group_index (defaults to 0)"
}
variable "http_tcp_listeners" {
type = any
default = []
description = "A list of maps describing the HTTP listeners or TCP ports for this ALB. Required key/values: port, protocol. Optional key/values: target_group_index (defaults to http_tcp_listeners[count.index])"
}
variable "target_groups" {
description = "A list of maps containing key/value pairs that define the target groups to be created. Order of these maps is important and the index of these are to be referenced in listener definitions. Required key/values: name, backend_protocol, backend_port. Optional key/values are in the target_groups_defaults variable."
type = any
default = []
}
variable "subnets" {
type = list(any)
default = []
description = "A list of subnet IDs to attach to the LB. Subnets cannot be updated for Load Balancers of type network. Changing this value will for load balancers of type network will force a recreation of the resource."
}
variable "enable_deletion_protection" {
type = bool
default = false
description = "If true, deletion of the load balancer will be disabled via the AWS API. This will prevent Terraform from deleting the load balancer. Defaults to false."
}
variable "https_port" {
type = number
default = 443
description = "The port on which the load balancer is listening. like 80 or 443."
}
variable "listener_protocol" {
type = string
default = "HTTPS"
description = "The protocol for connections from clients to the load balancer. Valid values are TCP, HTTP and HTTPS. Defaults to HTTP."
}
variable "http_port" {
type = number
default = 80
description = "The port on which the load balancer is listening. like 80 or 443."
}
variable "https_enabled" {
type = bool
default = true
description = "A boolean flag to enable/disable HTTPS listener."
}
variable "http_enabled" {
type = bool
default = true
description = "A boolean flag to enable/disable HTTP listener."
}
variable "listener_type" {
type = string
default = "forward"
description = "The type of routing action. Valid values are forward, redirect, fixed-response, authenticate-cognito and authenticate-oidc."
}
variable "listener_certificate_arn" {
type = string
sensitive = true
default = ""
description = "The ARN of the SSL server certificate. Exactly one certificate is required if the protocol is HTTPS."
}
variable "target_group_port" {
type = string
default = 80
description = "The port on which targets receive traffic, unless overridden when registering a specific target."
}
variable "vpc_id" {
type = string
default = ""
description = "The identifier of the VPC in which to create the target group."
}
variable "target_id" {
type = list(any)
description = "The ID of the target. This is the Instance ID for an instance, or the container ID for an ECS container. If the target type is ip, specify an IP address."
}
variable "idle_timeout" {
type = number
default = 60
description = "The time in seconds that the connection is allowed to be idle."
}
variable "enable_cross_zone_load_balancing" {
type = bool
default = true
description = "Indicates whether cross zone load balancing should be enabled in application load balancers."
}
variable "enable_http2" {
type = bool
default = true
description = "Indicates whether HTTP/2 is enabled in application load balancers."
}
variable "ip_address_type" {
type = string
default = "ipv4"
description = "The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 and dualstack."
}
variable "load_balancer_create_timeout" {
type = string
default = "10m"
description = "Timeout value when creating the ALB."
}
variable "load_balancer_delete_timeout" {
type = string
default = "10m"
description = "Timeout value when deleting the ALB."
}
variable "load_balancer_update_timeout" {
type = string
default = "10m"
description = "Timeout value when updating the ALB."
}
variable "http_listener_type" {
type = string
default = "redirect"
description = "The type of routing action. Valid values are forward, redirect, fixed-response, authenticate-cognito and authenticate-oidc."
}
variable "status_code" {
type = string
default = "HTTP_301"
description = " The HTTP redirect code. The redirect is either permanent (HTTP_301) or temporary (HTTP_302)."
}
variable "enable" {
type = bool
default = false
description = "If true, create alb."
}
variable "clb_enable" {
type = bool
default = false
description = "If true, create clb."
}
variable "listeners" {
default = []
type = list(object({
lb_port : number
lb_protocol : string
instance_port : number
instance_protocol : string
ssl_certificate_id : string
}))
description = "A list of listener configurations for the ELB."
}
variable "connection_draining_timeout" {
type = number
default = 300
description = "The time after which connection draining is aborted in seconds."
}
variable "connection_draining" {
type = bool
default = false
description = "TBoolean to enable connection draining. Default: false."
}
variable "health_check_target" {
description = "The target to use for health checks."
type = string
default = "TCP:80"
}
variable "health_check_timeout" {
type = number
default = 5
description = "The time after which a health check is considered failed in seconds."
}
variable "health_check_interval" {
description = "The time between health check attempts in seconds."
type = number
default = 30
}
variable "health_check_unhealthy_threshold" {
type = number
default = 2
description = "The number of failed health checks before an instance is taken out of service."
}
variable "health_check_healthy_threshold" {
type = number
default = 10
description = "The number of successful health checks before an instance is put into service."
}
variable "access_logs" {
type = map(string)
default = {}
description = "Map containing access logging configuration for load balancer."
}
variable "listener_https_fixed_response" {
description = "Have the HTTPS listener return a fixed response for the default action."
type = object({
content_type = string
message_body = string
status_code = string
})
default = null
}
variable "with_target_group" {
type = bool
default = true
description = "Create LoadBlancer without target group"
}
variable "enable_security_group" {
type = bool
default = true
description = "Enable default Security Group with only Egress traffic allowed."
}
variable "sg_ids" {
type = list(any)
default = []
description = "of the security group id."
}
variable "sg_description" {
type = string
default = "Instance default security group (only egress access is allowed)."
description = "The security group description."
}
variable "is_external" {
type = bool
default = false
description = "enable to udated existing security Group"
}
variable "egress_rule" {
type = bool
default = true
description = "Enable to create egress rule"
}
variable "sg_egress_description" {
type = string
default = "Description of the rule."
description = "Description of the egress and ingress rule"
}
variable "sg_egress_ipv6_description" {
type = string
default = "Description of the rule."
description = "Description of the egress_ipv6 rule"
}
variable "allowed_ip" {
type = list(any)
default = []
description = "List of allowed ip."
}
variable "allowed_ports" {
type = list(any)
default = []
description = "List of allowed ingress ports"
}
variable "sg_ingress_description" {
type = string
default = "Description of the ingress rule use elasticache."
description = "Description of the ingress rule"
}
variable "protocol" {
type = string
default = "tcp"
description = "The protocol. If not icmp, tcp, udp, or all use the."
}
variable "enable_tls_version_and_cipher_suite_headers" {
type = bool
default = false
description = "Indicates whether the two headers (x-amzn-tls-version and x-amzn-tls-cipher-suite), which contain information about the negotiated TLS version and cipher suite, are added to the client request before sending it to the target."
}
variable "enable_xff_client_port" {
type = bool
default = true
description = "Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer in application load balancers."
}
variable "preserve_host_header" {
type = bool
default = false
description = "Indicates whether Host header should be preserve and forward to targets without any change. Defaults to false."
}
variable "enable_waf_fail_open" {
type = bool
default = false
description = "Indicates whether to route requests to targets if lb fails to forward the request to AWS WAF"
}
variable "desync_mitigation_mode" {
type = string
default = "defensive"
description = "Determines how the load balancer handles requests that might pose a security risk to an application due to HTTP desync."
}
variable "xff_header_processing_mode" {
type = string
default = "append"
description = "Determines how the load balancer modifies the X-Forwarded-For header in the HTTP request before sending the request to the target."
}
variable "http_tcp_listener_rules" {
type = any
default = []
description = "A list of maps describing the Listener Rules for this ALB. Required key/values: actions, conditions. Optional key/values: priority, http_tcp_listener_index (default to http_tcp_listeners[count.index])"
}
variable "https_listener_rules" {
type = any
default = []
description = "A list of maps describing the Listener Rules for this ALB. Required key/values: actions, conditions. Optional key/values: priority, https_listener_index (default to https_listeners[count.index])"
}
variable "ssl_policy" {
type = string
default = "ELBSecurityPolicy-TLS-1-2-2017-01"
description = "Name of the SSL Policy for the listener. Required if protocol is HTTPS or TLS."
}
variable "extra_ssl_certs" {
description = "A list of maps describing any extra SSL certificates to apply to the HTTPS listeners. Required key/values: certificate_arn, https_listener_index (the index of the listener within https_listeners which the cert applies toward)."
type = list(map(string))
default = []
}
variable "from_port" {
type = number
default = 0
description = " (Required) Start port (or ICMP type number if protocol is icmp or icmpv6)."
}
variable "to_port" {
type = number
default = 65535
description = "equal to 0. The supported values are defined in the IpProtocol argument on the IpPermission API reference"
}
variable "egress_protocol" {
type = number
default = -1
description = "equal to 0. The supported values are defined in the IpProtocol argument on the IpPermission API reference"
}
variable "cidr_blocks" {
type = list(string)
default = ["0.0.0.0/0"]
description = "equal to 0. The supported values are defined in the IpProtocol argument on the IpPermission API reference"
}
variable "ipv6_cidr_blocks" {
type = list(string)
default = ["::/0"]
description = "Enable to create egress rule"
}