2

No clear path to do development in a serverless environment.

I have an API Gateway backed by some Lambda functions declared in Terraform. I deploy to the cloud and everything is fine, but how do I go about setting a proper workflow for development? It seems like a struggle to push every small code change to the cloud while developing in order to run your code. Terraform has started getting some support by the SAM framework to run your Lambda functions locally (https://aws.amazon.com/blogs/compute/better-together-aws-sam-cli-and-hashicorp-terraform/), but still no way to simulate a local server and test out your endpoints in Postman for example.

Solon
  • 21
  • 2

1 Answers1

0

First of all I use serverless plugin instead of terraform, my answer is based on what you provided and what I found around.
From what I understood so far with priovided documentation you are able to run sam CLI with terraform (cf: Chapter Local testing)

You might follow this documentation to invoke local functions.

I recommend to use JSON files to create use cases instead of stdin injection. First step is to create your payload in json file and to invoke your lambda with the json payload like

sam local invoke "YOUR_LAMBDA_NAME" -e ./path/to/yourjsonfile.json
IQbrod
  • 2,060
  • 1
  • 6
  • 28