terraform_api_gateway/README.md

1.1 KiB
Raw Permalink Blame History

terraform_api_gateway

API Gateway with terraform for learning!

deployment tasks

⚠️ require go-task and jq

task terraform_plan ENV=... => plan the terraform deployment + create a tfplan.json that resume the modifications.
task terraform_apply ENV=... => deploy the stack.
task terraform_destroy ENV=... => destroy the stack.

configured environments:

  • dev

test commmands

login to cognito from cli to get IdToken

Run:
aws cognito-idp initiate-auth --region <...> --auth-flow USER_PASSWORD_AUTH --client-id <...> --auth-parameters USERNAME=<...>,PASSWORD=<...>
Then copy the "IdToken" from response.

test an api endpoint with cognito authorizer

curl --header "Authorization: <IdToken>" https://<...>.execute-api.eu-west-1.amazonaws.com/<stage>/<route>

TODO

  • create a post route
  • body validation
  • reponse transformation
  • routes module
  • swagger documentation
  • use aws lambda module

critique du code

Il n'y as pas vraiment de plus value d'avoir une conf de backend par env avec les workspaces.