Skip to content

Commit c3c99ba

Browse files
committed
Work in progress
1 parent 61f3056 commit c3c99ba

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lambda.tf

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,28 @@ resource "null_resource" "lambda_build" {
3535
python3 -m pip install --upgrade pip;
3636
touch ${local.lambda_build_path}/requirements.txt;
3737
pip3 install -r ${local.lambda_build_path}/requirements.txt -t ${local.lambda_build_path};
38-
cd ${local.lambda_build_path};
39-
zip -r ${local.lambda_filename} ${local.lambda_build_path};
4038
COMMAND
4139
}
4240
}
4341

42+
# Create a zip of the build project
43+
resource "archive_file" "lambda_zip" {
44+
depends_on = [
45+
null_resource.lambda_build
46+
]
47+
type = "zip"
48+
source_dir = local.lambda_build_path
49+
output_path = local.lambda_filename
50+
}
51+
4452
# Lambda function
4553
resource "aws_lambda_function" "lambda" {
4654
depends_on = [
4755
null_resource.lambda_build
4856
]
4957
function_name = local.lambda_name_snake
5058
description = var.lambda_description
51-
filename = local.lambda_filename
59+
filename = archive_file.lambda_zip.output_path
5260
source_code_hash = filebase64sha256(data.archive_file.lambda_delta.output_path)
5361
role = aws_iam_role.lambda.arn
5462
handler = var.lambda_handler

0 commit comments

Comments
 (0)