This commit is contained in:
José Ivanchechen 2022-12-14 19:33:28 +00:00
parent 7a50a6b085
commit 90a890430c
1 changed files with 4 additions and 4 deletions

View File

@ -1,8 +1,8 @@
--- ---
title: "AWS API Gateway Terraform" title: "AWS API Gateway with Terraform"
date: 2022-12-01T15:30:00-03:00 date: 2022-12-01T15:30:00-03:00
draft: false draft: false
summary: "How to create API Gateway endpoints with Terraform." summary: "Creating API Gateway endpoints with Terraform."
--- ---
Right when we first started to use the AWS API Gateway, one of the things that did bother us was the fact that we had to manage lot of resources spread into 1,000s of lines of a couple of Terraform files, and it was a lot of work that required attention and time, things that are critical in software development as we all know. Right when we first started to use the AWS API Gateway, one of the things that did bother us was the fact that we had to manage lot of resources spread into 1,000s of lines of a couple of Terraform files, and it was a lot of work that required attention and time, things that are critical in software development as we all know.
@ -10,7 +10,7 @@ Right when we first started to use the AWS API Gateway, one of the things that d
So we decided to create a module to help us with this. Big thanks to [Stephano](https://www.linkedin.com/in/stephano-macedo/) who helped me a lot! So we decided to create a module to help us with this. Big thanks to [Stephano](https://www.linkedin.com/in/stephano-macedo/) who helped me a lot!
## Before ## Before
Basically, when we are developing a new API, we need to create a 3 resources in the API Gateway. We need to create a new gateway_resource, a new gateway_method and a new gateway_integration, and therefore connecting all of them using their respectives IDs. Basically, when we are developing a new API, we need to create a 3 resources in the API Gateway. We need to create a new gateway_resource, a new gateway_method and a new gateway_integration, and then connect all of them using their respectives IDs.
Let's suppose a endpoint called `/users/all`. This is a snippet of the code we had before: Let's suppose a endpoint called `/users/all`. This is a snippet of the code we had before:
@ -235,4 +235,4 @@ We can also add the `WWW-Authenticate` header to the request for example. We tri
## Note ## Note
This code has not been tested "as is", but it has been tested as part of a bigger project. There is always room for improvements and more possibilities depending on the context, but it's a good start. This code has not been tested "as is", but it has been tested as part of a bigger project. There is always room for improvements and more possibilities depending on the context, but it's a good start.
There has been a lot of pieces of Terraform code that was omitted, like when we use the declare the `terraform_remote_state` or the `authorizer_id` which you will need if using authorization "CUSTOM". There has been a lot of pieces of Terraform code that was omitted, like when we use the declare the `terraform_remote_state` or the `authorizer_id` which you will need if using authorization "CUSTOM".