forked from terraform-aws-modules/terraform-aws-lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
578 lines (479 loc) · 16.1 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
variable "create" {
description = "Controls whether resources should be created"
type = bool
default = true
}
variable "create_package" {
description = "Controls whether Lambda package should be created"
type = bool
default = true
}
variable "create_function" {
description = "Controls whether Lambda Function resource should be created"
type = bool
default = true
}
variable "create_layer" {
description = "Controls whether Lambda Layer resource should be created"
type = bool
default = false
}
variable "create_role" {
description = "Controls whether IAM role for Lambda Function should be created"
type = bool
default = true
}
###########
# Function
###########
variable "lambda_at_edge" {
description = "Set this to true if using Lambda@Edge, to enable publishing, limit the timeout, and allow edgelambda.amazonaws.com to invoke the function"
type = bool
default = false
}
variable "function_name" {
description = "A unique name for your Lambda Function"
type = string
default = ""
}
variable "handler" {
description = "Lambda Function entrypoint in your code"
type = string
default = ""
}
variable "runtime" {
description = "Lambda Function runtime"
type = string
default = ""
# validation {
# condition = can(var.create && contains(["nodejs10.x", "nodejs12.x", "java8", "java11", "python2.7", " python3.6", "python3.7", "python3.8", "dotnetcore2.1", "dotnetcore3.1", "go1.x", "ruby2.5", "ruby2.7", "provided"], var.runtime))
# error_message = "The runtime value must be one of supported by AWS Lambda."
# }
}
variable "lambda_role" {
description = " IAM role ARN attached to the Lambda Function. This governs both who / what can invoke your Lambda Function, as well as what resources our Lambda Function has access to. See Lambda Permission Model for more details."
type = string
default = ""
}
variable "description" {
description = "Description of your Lambda Function (or Layer)"
type = string
default = ""
}
variable "layers" {
description = "List of Lambda Layer Version ARNs (maximum of 5) to attach to your Lambda Function."
type = list(string)
default = null
}
variable "kms_key_arn" {
description = "The ARN of KMS key to use by your Lambda Function"
type = string
default = null
}
variable "memory_size" {
description = "Amount of memory in MB your Lambda Function can use at runtime. Valid value between 128 MB to 10,240 MB (10 GB), in 64 MB increments."
type = number
default = 128
}
variable "publish" {
description = "Whether to publish creation/change as new Lambda Function Version."
type = bool
default = false
}
variable "reserved_concurrent_executions" {
description = "The amount of reserved concurrent executions for this Lambda Function. A value of 0 disables Lambda Function from being triggered and -1 removes any concurrency limitations. Defaults to Unreserved Concurrency Limits -1."
type = number
default = -1
}
variable "timeout" {
description = "The amount of time your Lambda Function has to run in seconds."
type = number
default = 3
}
variable "dead_letter_target_arn" {
description = "The ARN of an SNS topic or SQS queue to notify when an invocation fails."
type = string
default = null
}
variable "environment_variables" {
description = "A map that defines environment variables for the Lambda Function."
type = map(string)
default = {}
}
variable "tracing_mode" {
description = "Tracing mode of the Lambda Function. Valid value can be either PassThrough or Active."
type = string
default = null
}
variable "vpc_subnet_ids" {
description = "List of subnet ids when Lambda Function should run in the VPC. Usually private or intra subnets."
type = list(string)
default = null
}
variable "vpc_security_group_ids" {
description = "List of security group ids when Lambda Function should run in the VPC."
type = list(string)
default = null
}
variable "tags" {
description = "A map of tags to assign to resources."
type = map(string)
default = {}
}
variable "s3_object_tags" {
description = "A map of tags to assign to S3 bucket object."
type = map(string)
default = {}
}
variable "package_type" {
description = "The Lambda deployment package type. Valid options: Zip or Image"
type = string
default = "Zip"
}
variable "image_uri" {
description = "The ECR image URI containing the function's deployment package."
type = string
default = null
}
variable "image_config_entry_point" {
description = "The ENTRYPOINT for the docker image"
type = list(string)
default = []
}
variable "image_config_command" {
description = "The CMD for the docker image"
type = list(string)
default = []
}
variable "image_config_working_directory" {
description = "The working directory for the docker image"
type = string
default = null
}
variable "source_code_hash" {
description = "User defined source hash"
type = string
default = null
}
########
# Layer
########
variable "layer_name" {
description = "Name of Lambda Layer to create"
type = string
default = ""
}
variable "license_info" {
description = "License info for your Lambda Layer. Eg, MIT or full url of a license."
type = string
default = ""
}
variable "compatible_runtimes" {
description = "A list of Runtimes this layer is compatible with. Up to 5 runtimes can be specified."
type = list(string)
default = []
}
############################
# Lambda Async Event Config
############################
variable "create_async_event_config" {
description = "Controls whether async event configuration for Lambda Function/Alias should be created"
type = bool
default = false
}
variable "create_current_version_async_event_config" {
description = "Whether to allow async event configuration on current version of Lambda Function (this will revoke permissions from previous version because Terraform manages only current resources)"
type = bool
default = true
}
variable "create_unqualified_alias_async_event_config" {
description = "Whether to allow async event configuration on unqualified alias pointing to $LATEST version"
type = bool
default = true
}
variable "maximum_event_age_in_seconds" {
description = "Maximum age of a request that Lambda sends to a function for processing in seconds. Valid values between 60 and 21600."
type = number
default = null
}
variable "maximum_retry_attempts" {
description = "Maximum number of times to retry when the function returns an error. Valid values between 0 and 2. Defaults to 2."
type = number
default = null
}
variable "destination_on_failure" {
description = "Amazon Resource Name (ARN) of the destination resource for failed asynchronous invocations"
type = string
default = null
}
variable "destination_on_success" {
description = "Amazon Resource Name (ARN) of the destination resource for successful asynchronous invocations"
type = string
default = null
}
##########################
# Provisioned Concurrency
##########################
variable "provisioned_concurrent_executions" {
description = "Amount of capacity to allocate. Set to 1 or greater to enable, or set to 0 to disable provisioned concurrency."
type = number
default = -1
}
############################################
# Lambda Permissions (for allowed triggers)
############################################
variable "create_current_version_allowed_triggers" {
description = "Whether to allow triggers on current version of Lambda Function (this will revoke permissions from previous version because Terraform manages only current resources)"
type = bool
default = true
}
variable "create_unqualified_alias_allowed_triggers" {
description = "Whether to allow triggers on unqualified alias pointing to $LATEST version"
type = bool
default = true
}
variable "allowed_triggers" {
description = "Map of allowed triggers to create Lambda permissions"
type = map(any)
default = {}
}
############################################
# Lambda Event Source Mapping
############################################
variable "event_source_mapping" {
description = "Map of event source mapping"
type = any
default = {}
}
#################
# CloudWatch Logs
#################
variable "use_existing_cloudwatch_log_group" {
description = "Whether to use an existing CloudWatch log group or create new"
type = bool
default = false
}
variable "cloudwatch_logs_retention_in_days" {
description = "Specifies the number of days you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653."
type = number
default = null
}
variable "cloudwatch_logs_kms_key_id" {
description = "The ARN of the KMS Key to use when encrypting log data."
type = string
default = null
}
variable "cloudwatch_logs_tags" {
description = "A map of tags to assign to the resource."
type = map(string)
default = {}
}
######
# IAM
######
variable "role_name" {
description = "Name of IAM role to use for Lambda Function"
type = string
default = null
}
variable "role_description" {
description = "Description of IAM role to use for Lambda Function"
type = string
default = null
}
variable "role_path" {
description = "Path of IAM role to use for Lambda Function"
type = string
default = null
}
variable "role_force_detach_policies" {
description = "Specifies to force detaching any policies the IAM role has before destroying it."
type = bool
default = true
}
variable "role_permissions_boundary" {
description = "The ARN of the policy that is used to set the permissions boundary for the IAM role used by Lambda Function"
type = string
default = null
}
variable "role_tags" {
description = "A map of tags to assign to IAM role"
type = map(string)
default = {}
}
###########
# Policies
###########
variable "attach_cloudwatch_logs_policy" {
description = "Controls whether CloudWatch Logs policy should be added to IAM role for Lambda Function"
type = bool
default = true
}
variable "attach_dead_letter_policy" {
description = "Controls whether SNS/SQS dead letter notification policy should be added to IAM role for Lambda Function"
type = bool
default = false
}
variable "attach_network_policy" {
description = "Controls whether VPC/network policy should be added to IAM role for Lambda Function"
type = bool
default = false
}
variable "attach_tracing_policy" {
description = "Controls whether X-Ray tracing policy should be added to IAM role for Lambda Function"
type = bool
default = false
}
variable "attach_async_event_policy" {
description = "Controls whether async event policy should be added to IAM role for Lambda Function"
type = bool
default = false
}
variable "attach_policy_json" {
description = "Controls whether policy_json should be added to IAM role for Lambda Function"
type = bool
default = false
}
variable "attach_policy_jsons" {
description = "Controls whether policy_jsons should be added to IAM role for Lambda Function"
type = bool
default = false
}
variable "attach_policy" {
description = "Controls whether policy should be added to IAM role for Lambda Function"
type = bool
default = false
}
variable "attach_policies" {
description = "Controls whether list of policies should be added to IAM role for Lambda Function"
type = bool
default = false
}
variable "number_of_policy_jsons" {
description = "Number of policies JSON to attach to IAM role for Lambda Function"
type = number
default = 0
}
variable "number_of_policies" {
description = "Number of policies to attach to IAM role for Lambda Function"
type = number
default = 0
}
variable "attach_policy_statements" {
description = "Controls whether policy_statements should be added to IAM role for Lambda Function"
type = bool
default = false
}
variable "trusted_entities" {
description = "Lambda Function additional trusted entities for assuming roles (trust relationship)"
type = list(string)
default = []
}
variable "policy_json" {
description = "An additional policy document as JSON to attach to the Lambda Function role"
type = string
default = null
}
variable "policy_jsons" {
description = "List of additional policy documents as JSON to attach to Lambda Function role"
type = list(string)
default = []
}
variable "policy" {
description = "An additional policy document ARN to attach to the Lambda Function role"
type = string
default = null
}
variable "policies" {
description = "List of policy statements ARN to attach to Lambda Function role"
type = list(string)
default = []
}
variable "policy_statements" {
description = "Map of dynamic policy statements to attach to Lambda Function role"
type = any
default = {}
}
variable "file_system_arn" {
description = "The Amazon Resource Name (ARN) of the Amazon EFS Access Point that provides access to the file system."
type = string
default = null
}
variable "file_system_local_mount_path" {
description = "The path where the function can access the file system, starting with /mnt/."
type = string
default = null
}
##########################
# Build artifact settings
##########################
variable "artifacts_dir" {
description = "Directory name where artifacts should be stored"
type = string
default = "builds"
}
variable "local_existing_package" {
description = "The absolute path to an existing zip-file to use"
type = string
default = null
}
variable "s3_existing_package" {
description = "The S3 bucket object with keys bucket, key, version pointing to an existing zip-file to use"
type = map(string)
default = null
}
variable "store_on_s3" {
description = "Whether to store produced artifacts on S3 or locally."
type = bool
default = false
}
variable "s3_object_storage_class" {
description = "Specifies the desired Storage Class for the artifact uploaded to S3. Can be either STANDARD, REDUCED_REDUNDANCY, ONEZONE_IA, INTELLIGENT_TIERING, or STANDARD_IA."
type = string
default = "ONEZONE_IA" # Cheaper than STANDARD and it is enough for Lambda deployments
}
variable "s3_bucket" {
description = "S3 bucket to store artifacts"
type = string
default = null
}
variable "source_path" {
description = "The absolute path to a local file or directory containing your Lambda source code"
type = any # string | list(string | map(any))
default = null
}
variable "hash_extra" {
description = "The string to add into hashing function. Useful when building same source path for different functions."
type = string
default = ""
}
variable "build_in_docker" {
description = "Whether to build dependencies in Docker"
type = bool
default = false
}
variable "docker_file" {
description = "Path to a Dockerfile when building in Docker"
type = string
default = ""
}
variable "docker_build_root" {
description = "Root dir where to build in Docker"
type = string
default = ""
}
variable "docker_image" {
description = "Docker image to use for the build"
type = string
default = ""
}
variable "docker_with_ssh_agent" {
description = "Whether to pass SSH_AUTH_SOCK into docker environment or not"
type = bool
default = false
}
variable "docker_pip_cache" {
description = "Whether to mount a shared pip cache folder into docker environment or not"
type = any
default = null
}