Translate project documentation to English
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
# 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
|
||||
https://localstack.paulononato.com.br
|
||||
```
|
||||
|
||||
## Recursos
|
||||
## Resources
|
||||
|
||||
- S3 bucket para artefatos da aplicacao Quantum.
|
||||
- SQS fila principal e DLQ.
|
||||
- Lambda Python para processar eventos.
|
||||
- IAM role e policies ficticias para a Lambda.
|
||||
- S3 bucket for Quantum application artifacts.
|
||||
- SQS main queue and DLQ.
|
||||
- Python Lambda function for event processing.
|
||||
- IAM role and fictional policies for the Lambda function.
|
||||
- CloudWatch Log Group.
|
||||
- Secrets Manager com credenciais simuladas.
|
||||
- Secrets Manager secret with simulated credentials.
|
||||
- Event source mapping SQS -> Lambda.
|
||||
|
||||
## Pre-requisitos
|
||||
## Prerequisites
|
||||
|
||||
- OpenTofu instalado.
|
||||
- AWS CLI opcional para testes.
|
||||
- Acesso ao endpoint LocalStack.
|
||||
- OpenTofu installed.
|
||||
- AWS CLI, optional for testing.
|
||||
- Access to the LocalStack endpoint.
|
||||
|
||||
Credenciais usadas pelo LocalStack:
|
||||
Credentials used by LocalStack:
|
||||
|
||||
```bash
|
||||
export AWS_ACCESS_KEY_ID=test
|
||||
@@ -32,7 +32,7 @@ export AWS_SECRET_ACCESS_KEY=test
|
||||
export AWS_DEFAULT_REGION=us-east-1
|
||||
```
|
||||
|
||||
No PowerShell:
|
||||
On PowerShell:
|
||||
|
||||
```powershell
|
||||
$env:AWS_ACCESS_KEY_ID="test"
|
||||
@@ -40,41 +40,41 @@ $env:AWS_SECRET_ACCESS_KEY="test"
|
||||
$env:AWS_DEFAULT_REGION="us-east-1"
|
||||
```
|
||||
|
||||
## Como usar
|
||||
## Usage
|
||||
|
||||
Inicializar:
|
||||
Initialize:
|
||||
|
||||
```bash
|
||||
tofu init
|
||||
```
|
||||
|
||||
Planejar:
|
||||
Plan:
|
||||
|
||||
```bash
|
||||
tofu plan
|
||||
```
|
||||
|
||||
Aplicar:
|
||||
Apply:
|
||||
|
||||
```bash
|
||||
tofu apply
|
||||
```
|
||||
|
||||
Destruir:
|
||||
Destroy:
|
||||
|
||||
```bash
|
||||
tofu destroy
|
||||
```
|
||||
|
||||
## Testes rapidos
|
||||
## Quick Tests
|
||||
|
||||
Listar buckets:
|
||||
List buckets:
|
||||
|
||||
```bash
|
||||
aws --endpoint-url https://localstack.paulononato.com.br s3 ls
|
||||
```
|
||||
|
||||
Enviar mensagem para a fila Quantum:
|
||||
Send a message to the Quantum queue:
|
||||
|
||||
```bash
|
||||
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"}'
|
||||
```
|
||||
|
||||
Ver segredo:
|
||||
Read the secret:
|
||||
|
||||
```bash
|
||||
aws --endpoint-url https://localstack.paulononato.com.br secretsmanager get-secret-value \
|
||||
--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" {
|
||||
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({
|
||||
Version = "2012-10-17"
|
||||
@@ -173,7 +173,7 @@ resource "aws_cloudwatch_log_group" "quantum_lambda" {
|
||||
|
||||
resource "aws_lambda_function" "quantum_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
|
||||
runtime = "python3.11"
|
||||
handler = "handler.lambda_handler"
|
||||
|
||||
+7
-7
@@ -1,34 +1,34 @@
|
||||
output "localstack_endpoint" {
|
||||
description = "Endpoint LocalStack usado pelo provider."
|
||||
description = "LocalStack endpoint used by the provider."
|
||||
value = var.localstack_endpoint
|
||||
}
|
||||
|
||||
output "quantum_bucket_name" {
|
||||
description = "Bucket S3 da aplicacao Quantum."
|
||||
description = "S3 bucket for the Quantum application."
|
||||
value = aws_s3_bucket.quantum_artifacts.bucket
|
||||
}
|
||||
|
||||
output "quantum_queue_url" {
|
||||
description = "URL da fila SQS principal."
|
||||
description = "Main SQS queue URL."
|
||||
value = aws_sqs_queue.quantum_events.url
|
||||
}
|
||||
|
||||
output "quantum_dlq_url" {
|
||||
description = "URL da fila DLQ."
|
||||
description = "DLQ URL."
|
||||
value = aws_sqs_queue.quantum_dlq.url
|
||||
}
|
||||
|
||||
output "quantum_lambda_name" {
|
||||
description = "Nome da Lambda processadora."
|
||||
description = "Processor Lambda function name."
|
||||
value = aws_lambda_function.quantum_processor.function_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
|
||||
}
|
||||
|
||||
output "quantum_secret_name" {
|
||||
description = "Nome do segredo no Secrets Manager."
|
||||
description = "Secrets Manager secret name."
|
||||
value = aws_secretsmanager_secret.quantum_app.name
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,23 +1,23 @@
|
||||
variable "aws_region" {
|
||||
description = "Regiao AWS simulada no LocalStack."
|
||||
description = "Simulated AWS region in LocalStack."
|
||||
type = string
|
||||
default = "us-east-1"
|
||||
}
|
||||
|
||||
variable "localstack_endpoint" {
|
||||
description = "Endpoint HTTPS do LocalStack."
|
||||
description = "LocalStack HTTPS endpoint."
|
||||
type = string
|
||||
default = "https://localstack.paulononato.com.br"
|
||||
}
|
||||
|
||||
variable "project_name" {
|
||||
description = "Nome curto do projeto ficticio."
|
||||
description = "Short name of the fictional project."
|
||||
type = string
|
||||
default = "quantum"
|
||||
}
|
||||
|
||||
variable "environment" {
|
||||
description = "Ambiente ficticio da aplicacao."
|
||||
description = "Fictional application environment."
|
||||
type = string
|
||||
default = "dev"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user