Translate project documentation to English
This commit is contained in:
@@ -1,30 +1,30 @@
|
|||||||
# aws-localstack
|
# aws-localstack
|
||||||
|
|
||||||
Projeto OpenTofu para provisionar recursos AWS simulados no LocalStack da aplicacao ficticia Quantum.
|
OpenTofu project for provisioning simulated AWS resources on LocalStack for the fictional Quantum application.
|
||||||
|
|
||||||
Endpoint LocalStack:
|
LocalStack endpoint:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
https://localstack.paulononato.com.br
|
https://localstack.paulononato.com.br
|
||||||
```
|
```
|
||||||
|
|
||||||
## Recursos
|
## Resources
|
||||||
|
|
||||||
- S3 bucket para artefatos da aplicacao Quantum.
|
- S3 bucket for Quantum application artifacts.
|
||||||
- SQS fila principal e DLQ.
|
- SQS main queue and DLQ.
|
||||||
- Lambda Python para processar eventos.
|
- Python Lambda function for event processing.
|
||||||
- IAM role e policies ficticias para a Lambda.
|
- IAM role and fictional policies for the Lambda function.
|
||||||
- CloudWatch Log Group.
|
- CloudWatch Log Group.
|
||||||
- Secrets Manager com credenciais simuladas.
|
- Secrets Manager secret with simulated credentials.
|
||||||
- Event source mapping SQS -> Lambda.
|
- Event source mapping SQS -> Lambda.
|
||||||
|
|
||||||
## Pre-requisitos
|
## Prerequisites
|
||||||
|
|
||||||
- OpenTofu instalado.
|
- OpenTofu installed.
|
||||||
- AWS CLI opcional para testes.
|
- AWS CLI, optional for testing.
|
||||||
- Acesso ao endpoint LocalStack.
|
- Access to the LocalStack endpoint.
|
||||||
|
|
||||||
Credenciais usadas pelo LocalStack:
|
Credentials used by LocalStack:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export AWS_ACCESS_KEY_ID=test
|
export AWS_ACCESS_KEY_ID=test
|
||||||
@@ -32,7 +32,7 @@ export AWS_SECRET_ACCESS_KEY=test
|
|||||||
export AWS_DEFAULT_REGION=us-east-1
|
export AWS_DEFAULT_REGION=us-east-1
|
||||||
```
|
```
|
||||||
|
|
||||||
No PowerShell:
|
On PowerShell:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
$env:AWS_ACCESS_KEY_ID="test"
|
$env:AWS_ACCESS_KEY_ID="test"
|
||||||
@@ -40,41 +40,41 @@ $env:AWS_SECRET_ACCESS_KEY="test"
|
|||||||
$env:AWS_DEFAULT_REGION="us-east-1"
|
$env:AWS_DEFAULT_REGION="us-east-1"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Como usar
|
## Usage
|
||||||
|
|
||||||
Inicializar:
|
Initialize:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
tofu init
|
tofu init
|
||||||
```
|
```
|
||||||
|
|
||||||
Planejar:
|
Plan:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
tofu plan
|
tofu plan
|
||||||
```
|
```
|
||||||
|
|
||||||
Aplicar:
|
Apply:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
tofu apply
|
tofu apply
|
||||||
```
|
```
|
||||||
|
|
||||||
Destruir:
|
Destroy:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
tofu destroy
|
tofu destroy
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testes rapidos
|
## Quick Tests
|
||||||
|
|
||||||
Listar buckets:
|
List buckets:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
aws --endpoint-url https://localstack.paulononato.com.br s3 ls
|
aws --endpoint-url https://localstack.paulononato.com.br s3 ls
|
||||||
```
|
```
|
||||||
|
|
||||||
Enviar mensagem para a fila Quantum:
|
Send a message to the Quantum queue:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
aws --endpoint-url https://localstack.paulononato.com.br sqs send-message \
|
aws --endpoint-url https://localstack.paulononato.com.br sqs send-message \
|
||||||
@@ -82,13 +82,13 @@ aws --endpoint-url https://localstack.paulononato.com.br sqs send-message \
|
|||||||
--message-body '{"event":"quantum.order.created","orderId":"QTM-1001"}'
|
--message-body '{"event":"quantum.order.created","orderId":"QTM-1001"}'
|
||||||
```
|
```
|
||||||
|
|
||||||
Ver segredo:
|
Read the secret:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
aws --endpoint-url https://localstack.paulononato.com.br secretsmanager get-secret-value \
|
aws --endpoint-url https://localstack.paulononato.com.br secretsmanager get-secret-value \
|
||||||
--secret-id "$(tofu output -raw quantum_secret_name)"
|
--secret-id "$(tofu output -raw quantum_secret_name)"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Observacao sobre RDS
|
## RDS Note
|
||||||
|
|
||||||
RDS nao esta incluido na edicao Community do LocalStack provisionada no servidor. Este projeto evita RDS e usa apenas os servicos disponiveis na stack atual.
|
RDS is not included in the LocalStack Community edition provisioned on the server. This project avoids RDS and uses only the services available in the current stack.
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ resource "aws_iam_role" "quantum_lambda" {
|
|||||||
|
|
||||||
resource "aws_iam_policy" "quantum_lambda" {
|
resource "aws_iam_policy" "quantum_lambda" {
|
||||||
name = "${local.name_prefix}-lambda-policy"
|
name = "${local.name_prefix}-lambda-policy"
|
||||||
description = "Permissoes simuladas da Lambda Quantum no LocalStack."
|
description = "Simulated permissions for the Quantum Lambda function on LocalStack."
|
||||||
|
|
||||||
policy = jsonencode({
|
policy = jsonencode({
|
||||||
Version = "2012-10-17"
|
Version = "2012-10-17"
|
||||||
@@ -173,7 +173,7 @@ resource "aws_cloudwatch_log_group" "quantum_lambda" {
|
|||||||
|
|
||||||
resource "aws_lambda_function" "quantum_processor" {
|
resource "aws_lambda_function" "quantum_processor" {
|
||||||
function_name = "${local.name_prefix}-processor"
|
function_name = "${local.name_prefix}-processor"
|
||||||
description = "Processador ficticio de eventos da aplicacao Quantum."
|
description = "Fictional event processor for the Quantum application."
|
||||||
role = aws_iam_role.quantum_lambda.arn
|
role = aws_iam_role.quantum_lambda.arn
|
||||||
runtime = "python3.11"
|
runtime = "python3.11"
|
||||||
handler = "handler.lambda_handler"
|
handler = "handler.lambda_handler"
|
||||||
|
|||||||
+7
-7
@@ -1,34 +1,34 @@
|
|||||||
output "localstack_endpoint" {
|
output "localstack_endpoint" {
|
||||||
description = "Endpoint LocalStack usado pelo provider."
|
description = "LocalStack endpoint used by the provider."
|
||||||
value = var.localstack_endpoint
|
value = var.localstack_endpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
output "quantum_bucket_name" {
|
output "quantum_bucket_name" {
|
||||||
description = "Bucket S3 da aplicacao Quantum."
|
description = "S3 bucket for the Quantum application."
|
||||||
value = aws_s3_bucket.quantum_artifacts.bucket
|
value = aws_s3_bucket.quantum_artifacts.bucket
|
||||||
}
|
}
|
||||||
|
|
||||||
output "quantum_queue_url" {
|
output "quantum_queue_url" {
|
||||||
description = "URL da fila SQS principal."
|
description = "Main SQS queue URL."
|
||||||
value = aws_sqs_queue.quantum_events.url
|
value = aws_sqs_queue.quantum_events.url
|
||||||
}
|
}
|
||||||
|
|
||||||
output "quantum_dlq_url" {
|
output "quantum_dlq_url" {
|
||||||
description = "URL da fila DLQ."
|
description = "DLQ URL."
|
||||||
value = aws_sqs_queue.quantum_dlq.url
|
value = aws_sqs_queue.quantum_dlq.url
|
||||||
}
|
}
|
||||||
|
|
||||||
output "quantum_lambda_name" {
|
output "quantum_lambda_name" {
|
||||||
description = "Nome da Lambda processadora."
|
description = "Processor Lambda function name."
|
||||||
value = aws_lambda_function.quantum_processor.function_name
|
value = aws_lambda_function.quantum_processor.function_name
|
||||||
}
|
}
|
||||||
|
|
||||||
output "quantum_log_group_name" {
|
output "quantum_log_group_name" {
|
||||||
description = "Log Group CloudWatch da Lambda."
|
description = "CloudWatch Log Group for the Lambda function."
|
||||||
value = aws_cloudwatch_log_group.quantum_lambda.name
|
value = aws_cloudwatch_log_group.quantum_lambda.name
|
||||||
}
|
}
|
||||||
|
|
||||||
output "quantum_secret_name" {
|
output "quantum_secret_name" {
|
||||||
description = "Nome do segredo no Secrets Manager."
|
description = "Secrets Manager secret name."
|
||||||
value = aws_secretsmanager_secret.quantum_app.name
|
value = aws_secretsmanager_secret.quantum_app.name
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -1,23 +1,23 @@
|
|||||||
variable "aws_region" {
|
variable "aws_region" {
|
||||||
description = "Regiao AWS simulada no LocalStack."
|
description = "Simulated AWS region in LocalStack."
|
||||||
type = string
|
type = string
|
||||||
default = "us-east-1"
|
default = "us-east-1"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "localstack_endpoint" {
|
variable "localstack_endpoint" {
|
||||||
description = "Endpoint HTTPS do LocalStack."
|
description = "LocalStack HTTPS endpoint."
|
||||||
type = string
|
type = string
|
||||||
default = "https://localstack.paulononato.com.br"
|
default = "https://localstack.paulononato.com.br"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "project_name" {
|
variable "project_name" {
|
||||||
description = "Nome curto do projeto ficticio."
|
description = "Short name of the fictional project."
|
||||||
type = string
|
type = string
|
||||||
default = "quantum"
|
default = "quantum"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "environment" {
|
variable "environment" {
|
||||||
description = "Ambiente ficticio da aplicacao."
|
description = "Fictional application environment."
|
||||||
type = string
|
type = string
|
||||||
default = "dev"
|
default = "dev"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user