You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
540 B
HCL
23 lines
540 B
HCL
resource "aws_iam_role" "lambda-role" {
|
|
name = "lambda-role"
|
|
assume_role_policy = var.policy
|
|
}
|
|
|
|
data "archive_file" "lambda-role" {
|
|
type = "zip"
|
|
source_file = "src/${var.name}.py"
|
|
output_path = "src/${var.name}.zip"
|
|
}
|
|
|
|
resource "aws_lambda_function" "lambda" {
|
|
function_name = var.name
|
|
runtime = "python3.11"
|
|
|
|
role = aws_iam_role.lambda-role.arn
|
|
|
|
handler = var.handler
|
|
filename = "src/${var.name}.zip"
|
|
source_code_hash = data.archive_file.lambda-role.output_base64sha256
|
|
}
|
|
|