@@ -17,28 +17,63 @@ resource "random_pet" "this" {
1717# Build packages
1818# ################
1919
20- # Create zip-archive of a single directory where "pip install" will also be executed (default for python runtime)
20+ # Create zip-archive of a single directory where "pip install" will also be executed (default for python runtime with requirements.txt present )
2121module "package_dir" {
2222 source = " ../../"
2323
2424 create_function = false
2525
26- runtime = " python3.8"
27- source_path = " ${ path . module } /../fixtures/python3.8-app1"
26+ build_in_docker = true
27+ runtime = " python3.8"
28+ source_path = " ${ path . module } /../fixtures/python3.8-app1"
29+ artifacts_dir = " ${ path . root } /builds/package_dir/"
2830}
2931
30- # Create zip-archive of a single directory where "pip install" will also be executed (default for python runtime) and set temporary directory for pip install
32+ # Create zip-archive of a single directory where "pip install" will also be executed (default for python runtime with requirements.txt present ) and set temporary directory for pip install
3133module "package_dir_pip_dir" {
3234 source = " ../../"
3335
3436 create_function = false
3537
36- runtime = " python3.8"
38+ build_in_docker = true
39+ runtime = " python3.8"
3740 source_path = [{
3841 path = " ${ path . module } /../fixtures/python3.8-app1"
3942 pip_tmp_dir = " ${ path . cwd } /../fixtures"
4043 pip_requirements = " ${ path . module } /../fixtures/python3.8-app1/requirements.txt"
4144 }]
45+ artifacts_dir = " ${ path . root } /builds/package_dir_pip_dir/"
46+ }
47+
48+ # Create zip-archive of a single directory where "poetry install" will also be executed
49+ module "package_dir_poetry" {
50+ source = " ../../"
51+
52+ create_function = false
53+
54+ build_in_docker = true
55+ runtime = " python3.8"
56+ source_path = [
57+ {
58+ path = " ${ path . module } /../fixtures/python3.8-app-poetry"
59+ patterns = [
60+ " !(.*/)*__pycache__/.*" ,
61+ " !_distutils_hack/.*" ,
62+ " !.pytest_cache/.*" ,
63+ " !.venv/.*" ,
64+ " !_virtualenv.pth" ,
65+ " !_virtualenv.py" ,
66+ " !distutils-precedence.pth" ,
67+ " !easy_install.py" ,
68+ " !(pip|pip-.*)(\\ .virtualenv|/.*)" ,
69+ " !(pkg_resources|pkg_resources-.*)(\\ .virtualenv|/.*)" ,
70+ " !(setuptools|setuptools-.*)(\\ .virtualenv|/.*)" ,
71+ " !(wheel|wheel-.*)(\\ .virtualenv|/.*)" ,
72+ ]
73+ poetry_install = true
74+ }
75+ ]
76+ artifacts_dir = " ${ path . root } /builds/package_dir_poetry/"
4277}
4378
4479# Create zip-archive of a single directory without running "pip install" (which is default for python runtime)
@@ -241,6 +276,44 @@ module "lambda_layer" {
241276 build_in_docker = true
242277 runtime = " python3.8"
243278 docker_file = " ${ path . module } /../fixtures/python3.8-app1/docker/Dockerfile"
279+ docker_image = " lambci/lambda:build-python3.8"
280+ artifacts_dir = " ${ path . root } /builds/lambda_layer/"
281+ }
282+
283+ module "lambda_layer_poetry" {
284+ source = " ../../"
285+
286+ create_layer = true
287+ layer_name = " ${ random_pet . this . id } -layer-poetry-dockerfile"
288+ compatible_runtimes = [" python3.8" ]
289+
290+ source_path = [
291+ {
292+ path = " ${ path . module } /../fixtures/python3.8-app-poetry"
293+ patterns = [
294+ " !(.*/)*__pycache__/.*" ,
295+ " !_distutils_hack/.*" ,
296+ " !.pytest_cache/.*" ,
297+ " !.venv/.*" ,
298+ " !_virtualenv.pth" ,
299+ " !_virtualenv.py" ,
300+ " !distutils-precedence.pth" ,
301+ " !easy_install.py" ,
302+ " !(pip|pip-.*)(\\ .virtualenv|/.*)" ,
303+ " !(pkg_resources|pkg_resources-.*)(\\ .virtualenv|/.*)" ,
304+ " !(setuptools|setuptools-.*)(\\ .virtualenv|/.*)" ,
305+ " !(wheel|wheel-.*)(\\ .virtualenv|/.*)" ,
306+ ]
307+ poetry_install = true
308+ }
309+ ]
310+ hash_extra = " extra-hash-to-prevent-conflicts-with-module.package_dir"
311+
312+ build_in_docker = true
313+ runtime = " python3.8"
314+ docker_file = " ${ path . module } /../fixtures/python3.8-poetry/docker/Dockerfile"
315+ docker_image = " lambci/lambda:build-python3.8"
316+ artifacts_dir = " ${ path . root } /builds/lambda_layer_poetry/"
244317}
245318
246319# ######################
0 commit comments