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
886 stars 656 forks source link

Add support for build, package & deploy of Golang + arm64 + provided.al2 #455

Closed vainkop closed 11 months ago

vainkop commented 1 year ago

Is your request related to a new offering from AWS?

No

Is your request related to a problem? Please describe.

It doesn't look possible to use the current implementation of the module & package.py to build, package & deploy a Golang lambda for arm64 for provided.al2 runtime (which is the only run time at the moment working with arm64 Golang)

Describe the solution you'd like.

To be able to configure build, package & deploy for Golang + arm64 + provided.al2 runtime out of the box.

It is probably a good idea to make it possible to fully redefine the commands used for the build inline + be able to use external Makefile regardless of the runtime & architecture.

A simple example of a Golang + arm64 build + package:

env GOOS=linux GOARCH=arm64 go build -o bootstrap src/main.go
zip -j deploy.zip bootstrap

https://docs.aws.amazon.com/lambda/latest/dg/golang-package.html

https://aws.amazon.com/blogs/compute/migrating-aws-lambda-functions-to-arm-based-aws-graviton2-processors/

https://github.com/mthenw/serverless-go-plugin/blob/master/README.md#how-to-run-golang-lambda-on-arm

github-actions[bot] commented 1 year 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

vi2co commented 1 year ago

+1 to keep this issue open

villekr commented 1 year ago

ARM64 AL2 would be also interesting. How would one use this module for deploying Go Lambda for X86_64 architecture? Simple example would be nice. I've used this module so far with Python and Node.js with layers so will start to look also using this with Go.

vi2co commented 1 year ago

@villekr I would like to use it for Loki Promtail Lambda (X86_64 or ARM64). So far I just put compiled Lambda archive into my Terraform repo. It would be nice to automate this process with Terraform e.g. download the source code from Github, build it and deploy Lambda.

vainkop commented 1 year ago

It looks pretty clear that to add Golang arm builds support one needs to either work on package.py or add a condition into package.tf which will trigger a different script for the required build. Too bad I don't have time to implement it at the moment, hopefully I will find it soon (or someone else will).

github-actions[bot] commented 11 months 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 11 months ago

This issue was automatically closed because of stale in 10 days

github-actions[bot] commented 10 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.