-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add terraform lambda layers sample + migrate serverless sample to new dir #238
base: master
Are you sure you want to change the base?
Conversation
de67b78
to
5b24623
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after updaing the Terraform installation and validating the Lambda invocation for CI.
Thank you for pushing this out @HarshCasper 👍
@which awslocal || pip install awscli-local | ||
@which terraform || (\ | ||
echo 'Terraform was not found, installing locally' && \ | ||
wget https://releases.hashicorp.com/terraform/1.0.8/terraform_1.0.8_linux_amd64.zip && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated Terraform version and hardcoding amd64 fails on ARM machines.
https://developer.hashicorp.com/terraform/install
output.json | ||
cat output.json | ||
|
||
run: start install package init deploy invoke |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding some (minimal) validation step. We should at least check that the Lambda invoked successfully and did not fail for the CI to catch regressions.
rm -rf .terraform | ||
rf -f output.json | ||
|
||
.PHONY: start install init deploy invoke clean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: incomplete missing (e.g., missing run
, start
, ...)
Make sure that LocalStack is started: | ||
|
||
``` | ||
LOCALSTACK_AUTH_TOKEN=... DEBUG=1 localstack start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General Idea for docs: Would it make sense to use a variable such as $LOCALSTACK_AUTH_TOKEN
to facilitate copy/pasting the command rather using some bash-incompatible placeholder (e.g., ...
or <>
)?
@test -e .venv || ($(PYTHON_BIN) -m venv .venv; source .venv/bin/activate; pip3 install terraform-local;) | ||
|
||
package: | ||
source .venv/bin/activate; pip install \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment pointing to the AWS packaging docs for Python would be helpful here: https://docs.aws.amazon.com/lambda/latest/dg/python-package.html
In particular, mention the limitation that dependencies with native dependencies require further configuration and should ideally be build using Docker.
|
||
## Prerequisites | ||
|
||
* LocalStack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should clarify that Layers require the Pro image here
This PR:
serverless-lambda-layers
sample tolambda-layers
directoryTODO