-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlambda_function.tf
More file actions
33 lines (27 loc) · 868 Bytes
/
lambda_function.tf
File metadata and controls
33 lines (27 loc) · 868 Bytes
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
data "archive_file" "lambda" {
type = "zip"
output_path = "${path.module}/dist/lambda.zip"
source_dir = "${path.module}/placeholders/${var.lambda_runtime}"
}
resource "aws_lambda_function" "lambda" {
filename = data.archive_file.lambda.output_path
function_name = var.lambda_function_name
role = aws_iam_role.lambda.arn
handler = var.lambda_handler
runtime = var.lambda_runtime
lifecycle {
ignore_changes = ["filename", "last_modified", "source_code_hash"]
}
dynamic environment {
for_each = length(var.environment_variables) > 0 ? [true] : []
content {
variables = var.environment_variables
}
}
tags = var.tags
}
resource "aws_cloudwatch_log_group" "logs" {
name = "/aws/lambda/${var.lambda_function_name}"
retention_in_days = 7
tags = var.tags
}