THEY-Consulting / they-terraform

Helper modules for an easier terraform life
3 stars 0 forks source link

Feature - Lambda function with Go runtime #89

Closed erodrigufer closed 4 months ago

erodrigufer commented 4 months ago

This PR adds an example to the Lambda module that shows how to deploy a Lambda function using Go to program it.

PR instructions

  1. Check code changes
  2. Deploy resources
cd  ./examples/aws/lambda_with_go_runtime
# Check that you are using your personal workspace
terraform workspace list
terraform init
terraform apply
  1. Go to Lambda in the AWS console in the europe-central-1 region. You should find your newly deployed Lambda there.
  2. Go to the page of your Lambda function. Go to the Test menu of the function. Send a test event with a JSON payload similar to this:
{
  "name": "Max Mustermann"
}
  1. After pressing Test and sending your event, you should get a successful response along the lines of this:
{
  "status": "ok",
  "message": "Hello Max Mustermann!",
  "request_id": "e5754bb1-0d57-4374-b974-148a4a599cba"
}
Screenshot 2024-07-03 at 17 31 22
  1. You should also be capable of reading the logs in Cloudwatch related to this Lambda function.

  2. Cleanup: destroy the resources that you deployed to test this PR:

terraform destroy

The steps of acceptance

✔ I executed the PR instructions and everything worked.

✔ I checked the requirements for the ticket, and they are matching the PR.

✔ I am satisfied with the code and left annotations if I had some ideas.