Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Commit 241c2ab

Browse files
Merge pull request #22 from Grupo-G03-4SOAT-FIAP/feature/105/api-gateway
refactor: atualização no api gateway
2 parents b3b7ca7 + 17fe702 commit 241c2ab

File tree

6 files changed

+17
-22
lines changed

6 files changed

+17
-22
lines changed

main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ module "db" {
7171

7272
module "api-gateway" {
7373
source = "./modules/api-gateway"
74+
75+
region = local.region
76+
tags = local.tags
7477
}
7578

7679
################################################################################
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "aws_api_gateway_rest_api" "minha_api" {
2-
name = "my-api"
3-
description = "My API Gateway"
2+
name = "rms-bff"
3+
description = "BFF do Restaurant Management System"
44
}
55

66
# resource "aws_api_gateway_authorizer" "my_authorizer" {
@@ -9,8 +9,3 @@ resource "aws_api_gateway_rest_api" "minha_api" {
99
# type = "COGNITO_USER_POOLS"
1010
# provider_arns = [var.cognito_arn]
1111
# }
12-
13-
14-
15-
16-

modules/api-gateway/gateway/outputs.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ output "api_gateway_id" {
55
# output "resource_id" {
66
# value = aws_api_gateway_resource.my_resource.id
77
# }
8-

modules/api-gateway/main.tf

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# main.tf
2-
31
provider "aws" {
4-
region = "us-east-1"
2+
region = var.region
53
}
64

75
module "gateway" {
@@ -14,22 +12,19 @@ module "rotas_api" {
1412
rotas = [
1513
{
1614
path = "catalogo"
17-
http_method = "GET"
18-
uri = "https://exemplo.com/rota1"
15+
http_method = "ANY"
16+
uri = "http://www.example.com/rota1"
1917
},
2018
{
2119
path = "pedido"
22-
http_method = "POST"
23-
uri = "https://exemplo.com/rota2"
20+
http_method = "ANY"
21+
uri = "http://www.example.com/pedido"
2422
},
2523
{
2624
path = "pagamento"
27-
http_method = "POST"
28-
uri = "https://exemplo.com/rota3"
25+
http_method = "ANY"
26+
uri = "http://www.example.com/rota3"
2927
},
3028
# Adicione quantas rotas você precisar
3129
]
3230
}
33-
34-
35-

modules/api-gateway/rotas/rotas_api.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ variable "rotas" {
88

99
variable "gateway_id" {}
1010

11-
1211
resource "aws_api_gateway_resource" "my_resource" {
1312
for_each = { for idx, rota in var.rotas : idx => rota }
1413

@@ -17,7 +16,6 @@ resource "aws_api_gateway_resource" "my_resource" {
1716
path_part = each.value.path
1817
}
1918

20-
2119
resource "aws_api_gateway_method" "rotas" {
2220
for_each = { for idx, rota in var.rotas : idx => rota }
2321

modules/api-gateway/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ variable "region" {
77
default = "us-east-1"
88
}
99

10+
variable "tags" {
11+
description = "Tags to set."
12+
type = map(string)
13+
default = {}
14+
}

0 commit comments

Comments
 (0)