-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.tf
More file actions
47 lines (38 loc) · 1.2 KB
/
Copy pathfunctions.tf
File metadata and controls
47 lines (38 loc) · 1.2 KB
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
resource "aws_lambda_function" "lambda" {
for_each = local.lambdas_map
filename = each.value.zip_file_path
function_name = each.value.function_name
role = each.value.role_arn
handler = each.value.handler
runtime = each.value.runtime
timeout = each.value.timeout
memory_size = each.value.memory
source_code_hash = filebase64sha256(each.value.zip_file_path)
description = each.value.description
layers = each.value.lambda_layers
reserved_concurrent_executions = each.value.reserved_concurrent_executions
environment {
variables = each.value.environment_variables
}
ephemeral_storage {
size = each.value.storage
}
dynamic "vpc_config" {
for_each = length(each.value.subnet_ids) > 0 ? [1] : []
content {
subnet_ids = each.value.subnet_ids
security_group_ids = each.value.security_group_ids
}
}
tags = {
Name = each.value.function_name
}
}
resource "aws_cloudwatch_log_group" "lambda_logs" {
for_each = local.lambdas_map
name = "/aws/lambda/${each.value.function_name}"
retention_in_days = 14
tags = {
Name = "${each.value.function_name}-logs"
}
}