Add Quantum LocalStack OpenTofu project
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
# aws-localstack
|
||||
|
||||
Projeto OpenTofu para provisionar recursos AWS simulados no LocalStack da aplicacao ficticia Quantum.
|
||||
|
||||
Endpoint LocalStack:
|
||||
|
||||
```text
|
||||
https://localstack.paulononato.com.br
|
||||
```
|
||||
|
||||
## Recursos
|
||||
|
||||
- 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.
|
||||
- CloudWatch Log Group.
|
||||
- Secrets Manager com credenciais simuladas.
|
||||
- Event source mapping SQS -> Lambda.
|
||||
|
||||
## Pre-requisitos
|
||||
|
||||
- OpenTofu instalado.
|
||||
- AWS CLI opcional para testes.
|
||||
- Acesso ao endpoint LocalStack.
|
||||
|
||||
Credenciais usadas pelo LocalStack:
|
||||
|
||||
```bash
|
||||
export AWS_ACCESS_KEY_ID=test
|
||||
export AWS_SECRET_ACCESS_KEY=test
|
||||
export AWS_DEFAULT_REGION=us-east-1
|
||||
```
|
||||
|
||||
No PowerShell:
|
||||
|
||||
```powershell
|
||||
$env:AWS_ACCESS_KEY_ID="test"
|
||||
$env:AWS_SECRET_ACCESS_KEY="test"
|
||||
$env:AWS_DEFAULT_REGION="us-east-1"
|
||||
```
|
||||
|
||||
## Como usar
|
||||
|
||||
Inicializar:
|
||||
|
||||
```bash
|
||||
tofu init
|
||||
```
|
||||
|
||||
Planejar:
|
||||
|
||||
```bash
|
||||
tofu plan
|
||||
```
|
||||
|
||||
Aplicar:
|
||||
|
||||
```bash
|
||||
tofu apply
|
||||
```
|
||||
|
||||
Destruir:
|
||||
|
||||
```bash
|
||||
tofu destroy
|
||||
```
|
||||
|
||||
## Testes rapidos
|
||||
|
||||
Listar buckets:
|
||||
|
||||
```bash
|
||||
aws --endpoint-url https://localstack.paulononato.com.br s3 ls
|
||||
```
|
||||
|
||||
Enviar mensagem para a fila Quantum:
|
||||
|
||||
```bash
|
||||
aws --endpoint-url https://localstack.paulononato.com.br sqs send-message \
|
||||
--queue-url "$(tofu output -raw quantum_queue_url)" \
|
||||
--message-body '{"event":"quantum.order.created","orderId":"QTM-1001"}'
|
||||
```
|
||||
|
||||
Ver segredo:
|
||||
|
||||
```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 nao esta incluido na edicao Community do LocalStack provisionada no servidor. Este projeto evita RDS e usa apenas os servicos disponiveis na stack atual.
|
||||
Reference in New Issue
Block a user