Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Question - How do you provide and use python requirements.txt #66

Open
ryanash999 opened this issue Feb 26, 2020 · 3 comments
Open

Question - How do you provide and use python requirements.txt #66

ryanash999 opened this issue Feb 26, 2020 · 3 comments

Comments

@ryanash999
Copy link

The documentation indicates that a requirements.txt can be used to automatically build with the necessary python modules. Where is requirements.txt placed? How is it referenced? Documentation could be expanded a bit for this portion.

Thanks

@raymondbutcher
Copy link
Contributor

Hi.

Just to quickly answer your questions, this test:

module "lambda_python3" {
source = "../../../"
function_name = "terraform-aws-lambda-test-python3-from-python3"
description = "Test python3 runtime from python3 environment in terraform-aws-lambda"
handler = "main.lambda_handler"
runtime = "python3.7"
timeout = 5
source_path = "${path.module}/../lambda"

uses this directory for the source path:

https://github.com/claranet/terraform-aws-lambda/tree/master/tests/python-versions/lambda

And you can see that requirements.txt is just sitting in the top of source directory.

This module copies the source path into a temporary directory, runs pip install requirements.txt if the file exists, zips up the temporary directory, then uses that for the Lambda function package.

@ryanash999
Copy link
Author

Thanks!

@raymondbutcher
Copy link
Contributor

Reopening so we don't forget to make this clearer in the readme.

mbklein pushed a commit to nulib/terraform-aws-lambda that referenced this issue Apr 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants