3 ms·
We use terraform and terragrunt by themselves to deploy lambdas. No frameworks. It's slightly more work, I guess. But deploying and understanding how deployment
by lovehashbrowns 6y ago
We use terraform and terragrunt by themselves to deploy lambdas. No frameworks. It's slightly more work, I guess. But deploying and understanding how deployments happen is easier this way. Plus, getting any kind of framework approved in a corporation is annoying as heck, whereas we already use terraform and terragrunt.
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function https://registry.terraform.io/providers/hashicorp/aws/latest...
The biggest annoyance is unit testing, although it forces certain good habits on us. So for example, since we don't use SAM, we have to do unit testing separately (our code is in Python). But because we can't exactly run a lambda via Python, we have to put most of our code in the layers that our lambdas import.
So we run unit tests on the layers, and the positive is that we can essentially copy and paste the code that our lambdas would run into the unit tests. And then we can keep it DRY because almost all the code is in layers, and that incentivizes us to create generic functions that can be used across all of our lambdas.
For things like unit testing DynamoDB, we use Moto which works exceptionally well.
https://pypi.org/project/moto/ https://pypi.org/project/moto/
More detail:
Our terraform has infrastructure code for:
API Gateways
Hard-coded API keys we use for testing
DynamoDB tables
IAM roles used by the Lambdas and Step Functions
Lambdas themselves
s3 buckets used for the Lambda zip files and state
Step functions