File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -35,20 +35,28 @@ resource "null_resource" "lambda_build" {
35
35
python3 -m pip install --upgrade pip;
36
36
touch ${ local . lambda_build_path } /requirements.txt;
37
37
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 } ;
40
38
COMMAND
41
39
}
42
40
}
43
41
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
+
44
52
# Lambda function
45
53
resource "aws_lambda_function" "lambda" {
46
54
depends_on = [
47
55
null_resource. lambda_build
48
56
]
49
57
function_name = local. lambda_name_snake
50
58
description = var. lambda_description
51
- filename = local . lambda_filename
59
+ filename = archive_file . lambda_zip . output_path
52
60
source_code_hash = filebase64sha256 (data. archive_file . lambda_delta . output_path )
53
61
role = aws_iam_role. lambda . arn
54
62
handler = var. lambda_handler
You can’t perform that action at this time.
0 commit comments