Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Adicionando dynamo e enviroments na lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
nsosoares committed Jul 11, 2024
1 parent b29ed30 commit 4234b50
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/terraform-api-gateway/modules/lambda/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ resource "aws_lambda_function" "tech_lanches_lambda_cadastro" {
memory_size = 512
}


data "aws_lb" "eks_lb_api_pedido" {
tags = {
"kubernetes.io/service-name" = "techlanches/api-pedido-service"
}
}

data "aws_lb" "eks_lb_api_pagamento" {
tags = {
"kubernetes.io/service-name" = "techlanches/api-pagamento-service"
}
}

data "aws_lb" "eks_lb_api_producao" {
tags = {
"kubernetes.io/service-name" = "techlanches/api-producao-service"
}
}

resource "aws_lambda_function" "tech_lanches_lambda_inativacao" {
function_name = "tech-lanches-lambda-inativacao"
filename = "../../auth_lambda.zip"
Expand All @@ -35,4 +54,10 @@ resource "aws_lambda_function" "tech_lanches_lambda_inativacao" {
}
timeout = 30
memory_size = 512
environment {
variables = {
PEDIDO_SERVICE = data.aws_lb.eks_lb_api_pedido.dns_name
PAGAMENTO_SERVICE = data.aws_lb.eks_lb_api_pagamento.dns_name
}
}
}
30 changes: 30 additions & 0 deletions src/terraform-infra/modules/dynamoDb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@ provider "aws" {
region = var.aws_region
}

resource "aws_dynamodb_table" "usuario_inativo" {
name = "usuario_inativo"
billing_mode = "PAY_PER_REQUEST"
hash_key = "Id"

attribute {
name = "Id"
type = "S"
}

attribute {
name = "Cpf"
type = "S"
}

# Definição do índice global secundário
global_secondary_index {
name = "cpfIndex"
hash_key = "Cpf"
projection_type = "ALL" # Projetar todos os atributos
}

tags = {
Name = "DynamoDB do TechLanches Serviço de Inativação de usuário"
Repository = "https://github.com/g12-4soat/techlanches-iac"
Environment = "Prod"
ManagedBy = "Terraform"
}
}

resource "aws_dynamodb_table" "pagamentos" {
name = "pagamentos"
billing_mode = "PAY_PER_REQUEST"
Expand Down

0 comments on commit 4234b50

Please sign in to comment.