Skip to content

Commit bfce47d

Browse files
authored
Merge branch 'master' into master
2 parents 3115104 + 3e553e9 commit bfce47d

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [7.18.0](https://github.com/terraform-aws-modules/terraform-aws-lambda/compare/v7.17.1...v7.18.0) (2025-01-08)
6+
7+
8+
### Features
9+
10+
* Allow temp dir for poetry docker builds ([#638](https://github.com/terraform-aws-modules/terraform-aws-lambda/issues/638)) ([65ffea2](https://github.com/terraform-aws-modules/terraform-aws-lambda/commit/65ffea2cfd99a27b6be3fc3e48482cf0fb821f2f))
11+
12+
## [7.17.1](https://github.com/terraform-aws-modules/terraform-aws-lambda/compare/v7.17.0...v7.17.1) (2025-01-07)
13+
14+
15+
### Bug Fixes
16+
17+
* Rename npm_package_json to npm_requirements ([#621](https://github.com/terraform-aws-modules/terraform-aws-lambda/issues/621)) ([4bc61eb](https://github.com/terraform-aws-modules/terraform-aws-lambda/commit/4bc61eb58005e149dc1ca87ba79f42b0cba944fd))
18+
519
## [7.17.0](https://github.com/terraform-aws-modules/terraform-aws-lambda/compare/v7.16.0...v7.17.0) (2024-12-08)
620

721

examples/build-package/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ module "lambda_layer_poetry" {
426426
{
427427
path = "${path.module}/../fixtures/python-app-poetry"
428428
poetry_install = true
429+
poetry_tmp_dir = "${path.cwd}/../fixtures"
429430
}
430431
]
431432
hash_extra = "extra-hash-to-prevent-conflicts-with-module.package_dir"

package.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ def pip_requirements_step(path, prefix=None, required=False, tmp_dir=None):
707707
hash(requirements)
708708

709709
def poetry_install_step(
710-
path, poetry_export_extra_args=[], prefix=None, required=False
710+
path, poetry_export_extra_args=[], prefix=None, required=False, tmp_dir=None
711711
):
712712
pyproject_file = path
713713
if os.path.isdir(path):
@@ -718,7 +718,7 @@ def poetry_install_step(
718718
"poetry configuration not found: {}".format(pyproject_file)
719719
)
720720
else:
721-
step("poetry", runtime, path, poetry_export_extra_args, prefix)
721+
step("poetry", runtime, path, poetry_export_extra_args, prefix, tmp_dir)
722722
hash(pyproject_file)
723723
pyproject_path = os.path.dirname(pyproject_file)
724724
poetry_lock_file = os.path.join(pyproject_path, "poetry.lock")
@@ -821,7 +821,9 @@ def commands_step(path, commands):
821821
pip_requirements = claim.get("pip_requirements")
822822
poetry_install = claim.get("poetry_install")
823823
poetry_export_extra_args = claim.get("poetry_export_extra_args", [])
824-
npm_requirements = claim.get("npm_package_json")
824+
npm_requirements = claim.get(
825+
"npm_requirements", claim.get("npm_package_json")
826+
)
825827
runtime = claim.get("runtime", query.runtime)
826828

827829
if pip_requirements and runtime.startswith("python"):
@@ -847,6 +849,7 @@ def commands_step(path, commands):
847849
prefix=prefix,
848850
poetry_export_extra_args=poetry_export_extra_args,
849851
required=True,
852+
tmp_dir=claim.get("poetry_tmp_dir"),
850853
)
851854

852855
if npm_requirements and runtime.startswith("nodejs"):
@@ -947,15 +950,12 @@ def execute(self, build_plan, zip_stream, query):
947950
# XXX: timestamp=0 - what actually do with it?
948951
zs.write_dirs(rd, prefix=prefix, timestamp=0)
949952
elif cmd == "poetry":
950-
(
951-
runtime,
952-
path,
953-
poetry_export_extra_args,
954-
prefix,
955-
) = action[1:]
953+
(runtime, path, poetry_export_extra_args, prefix, tmp_dir) = action[
954+
1:
955+
]
956956
log.info("poetry_export_extra_args: %s", poetry_export_extra_args)
957957
with install_poetry_dependencies(
958-
query, path, poetry_export_extra_args
958+
query, path, poetry_export_extra_args, tmp_dir
959959
) as rd:
960960
if rd:
961961
if pf:
@@ -1175,7 +1175,7 @@ def install_pip_requirements(query, requirements_file, tmp_dir):
11751175

11761176

11771177
@contextmanager
1178-
def install_poetry_dependencies(query, path, poetry_export_extra_args):
1178+
def install_poetry_dependencies(query, path, poetry_export_extra_args, tmp_dir):
11791179
# TODO:
11801180
# 1. Emit files instead of temp_dir
11811181

@@ -1229,7 +1229,7 @@ def install_poetry_dependencies(query, path, poetry_export_extra_args):
12291229
working_dir = os.getcwd()
12301230

12311231
log.info("Installing python dependencies with poetry & pip: %s", poetry_lock_file)
1232-
with tempdir() as temp_dir:
1232+
with tempdir(tmp_dir) as temp_dir:
12331233

12341234
def copy_file_to_target(file, temp_dir):
12351235
filename = os.path.basename(file)

0 commit comments

Comments
 (0)