-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda.tf
More file actions
26 lines (23 loc) · 723 Bytes
/
Copy pathlambda.tf
File metadata and controls
26 lines (23 loc) · 723 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
data "archive_file" "lambda_zip" {
type = "zip"
source_file = "${path.module}/src/lambda/index.py"
output_path = "${path.module}/dist/lambda.zip"
}
resource "aws_lambda_function" "api_handler" {
function_name = "${var.app_name}-handler"
filename = data.archive_file.lambda_zip.output_path
source_code_hash = data.archive_file.lambda_zip.output_base64sha256
role = aws_iam_role.lambda_exec.arn
handler = "index.handler"
runtime = "python3.11"
timeout = 30
environment {
variables = {
ENV = var.environment
APP_NAME = var.app_name
}
}
depends_on = [
aws_iam_role_policy_attachment.lambda_basic_execution
]
}