Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions examples/build-package/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,15 @@ module "lambda_layer_poetry" {
path = "${path.module}/../fixtures/python-app-poetry"
poetry_install = true
poetry_tmp_dir = "${path.cwd}/../fixtures"
# Patterns work correctly with poetry_install - only poetry files are needed
# The installed dependencies will be in the layer, but source files will be excluded
patterns = [
"!ignore_please.txt", # Exclude this file
"!index.py", # Exclude source code
"pyproject.toml", # Include poetry config
"poetry.lock", # Include lock file
"poetry.toml" # Include poetry settings
]
}
]
hash_extra = "extra-hash-to-prevent-conflicts-with-module.package_dir"
Expand Down
5 changes: 4 additions & 1 deletion package.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,10 @@ def commands_step(path, commands):
required=True,
tmp_dir=claim.get("npm_tmp_dir"),
)
if path:

# Only zip the source path if not using dependency managers
# (pip/poetry/npm handle their own zipping)
if path and not (pip_requirements or poetry_install or npm_requirements):
path = os.path.normpath(path)
step("zip", path, prefix)
if patterns:
Expand Down
Loading