Skip to content

Commit

Permalink
fix: lambda-layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalia committed Jan 28, 2024
1 parent 59c030c commit 888c364
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
9 changes: 9 additions & 0 deletions infra/api/make_lamda_layer/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
beautifulsoup4==4.9.1
certifi==2022.12.7
chardet==3.0.4
idna==2.10
requests==2.31.0
soupsieve==2.0.1
zulip==0.8.2
sentry-sdk==1.14.0
python-lambda==11.8.0
19 changes: 10 additions & 9 deletions infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -168,28 +168,29 @@ resource "null_resource" "lambda_layer" {
command = <<EOT
/bin/bash
python3 -m venv test_lambda_layer #Python is the name of de layer
pip install virtualenv
virtualenv --python=/usr/bin/python3.8 test_lambda_layer
soure python/bin/active
pip install -r api/requirements.txt -t python/lib/python3.8/site-pakages
#zip -r python.zip test_lambda_layer
zip -r python.zip test_lambda_layer
EOT
}
}
# Archive a single file.

data "archive_file" "test_zip" {
type = "zip"
source_dir = "test_lambda_layer"
output_path = "python.zip"
depends_on = [null_resource.lambda_layer]
}
# data "archive_file" "test_zip" {
# type = "zip"
# source_dir = "test_lambda_layer"
# output_path = "python.zip"
# depends_on = [null_resource.lambda_layer]
# }

resource "aws_lambda_layer_version" "test_lambda_layer" {
filename = "python.zip"
layer_name = "test_lambda_layer"
compatible_runtimes = ["python3.8", "python3.7"]
# depends_on = [null_resource.test_lamdazip]
#depends_on = [null_resource.lambda_layer]
}

resource "aws_lambda_function" "lambda" {
Expand Down

0 comments on commit 888c364

Please sign in to comment.