Skip to content

Commit 26f5f84

Browse files
authored
Merge pull request #46 from PythonFloripa/revert-44-dettach-application-infra
Revert "Remove Lambda module outputs, variables, and API Gateway module files"
2 parents 4c703eb + 5794d3b commit 26f5f84

File tree

12 files changed

+1907
-0
lines changed

12 files changed

+1907
-0
lines changed

terraform/env/dev/main.tf

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,55 @@ module "sqs" {
5959
project_name = var.project_name
6060
environment = var.environment
6161
}
62+
63+
# Lambda
64+
module "lambda" {
65+
source = "../../modules/05.lambda"
66+
project_name = var.project_name
67+
environment = var.environment
68+
aws_region = var.aws_region
69+
ecr_api_repository_name = module.ecr.api_repository_name
70+
ecr_api_repository_url = module.ecr.api_repository_url
71+
ecr_builder_repository_name = module.ecr.builder_repository_name
72+
ecr_builder_repository_url = module.ecr.builder_repository_url
73+
ecr_builder_repository_arn = module.ecr.builder_repository_arn
74+
ecr_notification_repository_name = module.ecr.notification_repository_name
75+
ecr_notification_repository_url = module.ecr.notification_repository_url
76+
ecr_notification_repository_arn = module.ecr.notification_repository_arn
77+
image_tag = var.lambda_image_tag
78+
lambda_timeout = var.lambda_timeout
79+
lambda_memory_size = var.lambda_memory_size
80+
log_retention_days = var.log_retention_days
81+
url_service_tech = var.url_service_tech
82+
prefix_api_version = var.prefix_api_version
83+
service_url_registration_api_solana = var.service_url_registration_api_solana
84+
service_api_key_registration_api_solana = var.service_api_key_registration_api_solana
85+
tech_floripa_certificate_validate_url = var.tech_floripa_certificate_validate_url
86+
tech_floripa_logo_url = var.tech_floripa_logo_url
87+
builder_queue_url = module.sqs.builder_queue_url
88+
builder_queue_arn = module.sqs.builder_queue_arn
89+
notification_queue_arn = module.sqs.notification_queue_arn
90+
notification_queue_url = module.sqs.notification_queue_url
91+
dynamodb_table_arns = [
92+
module.certificates_table.table_arn,
93+
module.orders_table.table_arn,
94+
module.participants_table.table_arn,
95+
module.products_table.table_arn
96+
]
97+
ecr_repository_arn = module.ecr.api_repository_arn
98+
s3_bucket_arn = module.s3.bucket_arn
99+
s3_bucket_name = module.s3.bucket_name
100+
api_gateway_download_url = module.api_gateway.api_endpoint_download_certificate
101+
}
102+
103+
# API Gateway
104+
module "api_gateway" {
105+
source = "../../modules/06.api-gateway"
106+
project_name = var.project_name
107+
environment = var.environment
108+
lambda_function_name = module.lambda.function_name
109+
lambda_invoke_arn = module.lambda.invoke_arn
110+
throttle_rate_limit = var.api_throttle_rate_limit
111+
throttle_burst_limit = var.api_throttle_burst_limit
112+
api_key_value = var.api_key_value
113+
}

terraform/env/dev/outputs.tf

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,74 @@ output "sqs_dlq_url" {
7979
description = "URL da Dead Letter Queue (builder)"
8080
value = module.sqs.builder_dlq_url
8181
}
82+
83+
# Informações do Lambda
84+
output "lambda_function_name" {
85+
description = "Nome da função Lambda"
86+
value = module.lambda.function_name
87+
}
88+
89+
output "lambda_function_arn" {
90+
description = "ARN da função Lambda"
91+
value = module.lambda.function_arn
92+
}
93+
94+
# Informações da Lambda de Notificação
95+
output "lambda_notification_function_name" {
96+
description = "Nome da função Lambda de Notificação"
97+
value = module.lambda.notification_function_name
98+
}
99+
100+
output "lambda_notification_function_arn" {
101+
description = "ARN da função Lambda de Notificação"
102+
value = module.lambda.notification_function_arn
103+
}
104+
105+
# Informações do API Gateway
106+
output "api_gateway_url" {
107+
description = "URL base do API Gateway"
108+
value = module.api_gateway.api_url
109+
}
110+
111+
output "api_gateway_endpoint_create_certificate" {
112+
description = "URL completa do endpoint para criar certificado"
113+
value = module.api_gateway.api_endpoint_create_certificate
114+
}
115+
116+
output "api_gateway_endpoint_download_certificate" {
117+
description = "URL base do endpoint para download de certificados"
118+
value = module.api_gateway.api_endpoint_download_certificate
119+
}
120+
121+
output "api_gateway_id" {
122+
description = "ID do API Gateway"
123+
value = module.api_gateway.api_id
124+
}
125+
126+
# Resumo completo da infraestrutura
127+
output "infrastructure_summary" {
128+
description = "Resumo completo da infraestrutura criada"
129+
value = {
130+
api_gateway = {
131+
id = module.api_gateway.api_id
132+
url = module.api_gateway.api_url
133+
endpoint_create_cert = module.api_gateway.api_endpoint_create_certificate
134+
}
135+
lambda = {
136+
function_name = module.lambda.function_name
137+
function_arn = module.lambda.function_arn
138+
notification_function_name = module.lambda.notification_function_name
139+
notification_function_arn = module.lambda.notification_function_arn
140+
}
141+
ecr = {
142+
repository_url = module.ecr.api_repository_url
143+
api_repository_name = module.ecr.api_repository_name
144+
}
145+
sqs = {
146+
queue_url = module.sqs.queue_url
147+
dlq_url = module.sqs.builder_dlq_url
148+
}
149+
environment = var.environment
150+
project = var.project_name
151+
}
152+
}

terraform/env/dev/variables.tf

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,87 @@ variable "project_name" {
5252

5353
# Configuração do DynamoDB - Modo de Baixo Custo
5454
# Todas as tabelas usam PAY_PER_REQUEST por padrão (paga apenas pelo que usar)
55+
56+
# Variáveis para Lambda Function
57+
variable "lambda_image_tag" {
58+
description = "Tag da imagem Docker para o Lambda"
59+
type = string
60+
default = "latest"
61+
}
62+
63+
variable "lambda_timeout" {
64+
description = "Timeout da função Lambda em segundos"
65+
type = number
66+
default = 60
67+
}
68+
69+
variable "lambda_memory_size" {
70+
description = "Memória alocada para a função Lambda em MB"
71+
type = number
72+
default = 512
73+
}
74+
75+
variable "log_retention_days" {
76+
description = "Dias de retenção dos logs do CloudWatch"
77+
type = number
78+
default = 3
79+
}
80+
81+
variable "url_service_tech" {
82+
description = "URL do serviço Tech Floripa"
83+
type = string
84+
default = "https://tech.floripa.br/wp-json/custom/v1"
85+
}
86+
87+
variable "prefix_api_version" {
88+
description = "Prefixo da versão da API"
89+
type = string
90+
default = "/api/v1"
91+
}
92+
93+
# Variáveis para API Gateway
94+
variable "api_throttle_rate_limit" {
95+
description = "Limite de taxa por segundo para throttling do API Gateway"
96+
type = number
97+
default = 100
98+
}
99+
100+
variable "api_throttle_burst_limit" {
101+
description = "Limite de burst para throttling do API Gateway"
102+
type = number
103+
default = 200
104+
}
105+
106+
variable "api_key_value" {
107+
description = "Valor da API Key para autenticação do API Gateway (deve ser fornecido via terraform.tfvars)"
108+
type = string
109+
sensitive = true
110+
111+
validation {
112+
condition = can(regex("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$", var.api_key_value))
113+
error_message = "A API Key deve estar no formato UUID válido (ex: 8a3f1e2c-9d7b-4f4a-8453-bf3c1d2a6f29)."
114+
}
115+
}
116+
117+
# Variáveis para integração com API Solana
118+
variable "service_url_registration_api_solana" {
119+
description = "URL do serviço de registro da API Solana"
120+
type = string
121+
}
122+
123+
variable "service_api_key_registration_api_solana" {
124+
description = "API Key do serviço de registro da API Solana"
125+
type = string
126+
sensitive = true
127+
}
128+
129+
variable "tech_floripa_certificate_validate_url" {
130+
description = "URL para validação de certificados do Tech Floripa"
131+
type = string
132+
}
133+
134+
variable "tech_floripa_logo_url" {
135+
description = "URL do logo do Tech Floripa"
136+
type = string
137+
default = "https://tech.floripa.br/wp-content/uploads/2025/03/Tech-Floripa-Qr.png"
138+
}

0 commit comments

Comments
 (0)