1 Answer
- Newest
- Most votes
- Most comments
1
When creating layers, there is a particular folder structure you have to follow. https://docs.aws.amazon.com/lambda/latest/dg/packaging-layers.html
You need to update the the ZIP file to look like the following..
googleapis.zip
|-python
|-googleapis
|-googleapis-x.x.x.x.dist-info
Then the libary should work so long as the layer was correctly attached to your function which you said was.
When you installed the GOOGLE API libary its installed in the root of your common\googleapis folder. You need to have a python\googleapi folder.
You could create a new folder in common and install libary as such. (There is 2 python folders for a reason)
pip install google-cloud-iam -t /Users/Documents/GitHub/Project/project/step_function/common/python/python
And then your TF would look like
data "archive_file" "googleapis_layer_archive" {
type = "zip"
source_dir = "${path.module}/common/python"
output_path = "${path.module}/common/zip/googleapis.zip"
}
# Python googleapis layer
resource "aws_lambda_layer_version" "googleapis_layer" {
filename = "${path.module}/common/zip/googleapis.zip"
layer_name = "googleapis"
source_code_hash = data.archive_file.snow_gcp_permission_handler_archive.output_base64sha256
compatible_runtimes = ["python3.8"]
}
Relevant content
- asked a year ago
- asked 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 4 months ago