terraform-aws-modules / terraform-aws-lambda

Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless combinations 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws
Apache License 2.0
902 stars 677 forks source link

Allow build in docker when not using pip/poetry/npm #605

Closed braun1928 closed 3 days ago

braun1928 commented 1 month ago

Is your request related to a problem? Please describe.

When building a lambda using i.e. golang, the build_in_docker = true is silently ignored. There is no way at the moment to run a build inside the platform.al2023 container.

Describe the solution you'd like.

Similarly to Python/Node runtimes, using build_in_docker that make it run in a docker container, avoiding installing a ton of different runtimes in the build machine (in this case, spacelift image).

Describe alternatives you've considered.

It all depends on changing package.py behaviour, as the plan json has the docker attributes as expected.

Additional context

The spacelift container runs in Alpine Linux, which uses musl, not available in the Lambda runtimes in AWS. So a simple go build requires musl (except obviously compiling statically) and won't work after deployment. If you make the build run in the container, then there won't be library issues. Current code does not allow that, as the docker_run_command is only called in npm/pip/poetry functions. For golang, if you don't specify custom commands, it just zips the source_path.

I just wanted the build plan to be respected -- why add all the docker info in the json file if it's not going to use it, and not even throw an warning because it is trying to run locally?

github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] commented 3 days ago

This issue was automatically closed because of stale in 10 days