Treat Quantum as a real application

This commit is contained in:
2026-04-20 16:55:57 -03:00
parent c363cab9bd
commit 8d396bd38a
6 changed files with 18 additions and 18 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
# aws-localstack # aws-localstack
OpenTofu project for provisioning simulated AWS resources on LocalStack for the fictional Quantum application. OpenTofu project for provisioning AWS resources on LocalStack for the Quantum application.
LocalStack endpoint: LocalStack endpoint:
@@ -13,9 +13,9 @@ https://localstack.paulononato.com.br
- S3 bucket for Quantum application artifacts. - S3 bucket for Quantum application artifacts.
- SQS main queue and DLQ. - SQS main queue and DLQ.
- Python Lambda function for event processing. - Python Lambda function for event processing.
- IAM role and fictional policies for the Lambda function. - IAM role and policies for the Lambda function.
- CloudWatch Log Group. - CloudWatch Log Group.
- Secrets Manager secret with simulated credentials. - Secrets Manager secret with application configuration.
- Event source mapping SQS -> Lambda. - Event source mapping SQS -> Lambda.
## Repository Layout ## Repository Layout
@@ -63,7 +63,7 @@ Choose an environment first:
cd environments/dev cd environments/dev
``` ```
Use `environments/stg` or `environments/prd` for the other simulated stages. Use `environments/stg` or `environments/prd` for the other stages.
Initialize: Initialize:
+2 -2
View File
@@ -1,5 +1,5 @@
variable "aws_region" { variable "aws_region" {
description = "Simulated AWS region in LocalStack." description = "AWS region used by LocalStack."
type = string type = string
default = "us-east-1" default = "us-east-1"
} }
@@ -11,7 +11,7 @@ variable "localstack_endpoint" {
} }
variable "project_name" { variable "project_name" {
description = "Short name of the fictional project." description = "Short name of the project."
type = string type = string
default = "quantum" default = "quantum"
} }
+2 -2
View File
@@ -1,5 +1,5 @@
variable "aws_region" { variable "aws_region" {
description = "Simulated AWS region in LocalStack." description = "AWS region used by LocalStack."
type = string type = string
default = "us-east-1" default = "us-east-1"
} }
@@ -11,7 +11,7 @@ variable "localstack_endpoint" {
} }
variable "project_name" { variable "project_name" {
description = "Short name of the fictional project." description = "Short name of the project."
type = string type = string
default = "quantum" default = "quantum"
} }
+2 -2
View File
@@ -1,5 +1,5 @@
variable "aws_region" { variable "aws_region" {
description = "Simulated AWS region in LocalStack." description = "AWS region used by LocalStack."
type = string type = string
default = "us-east-1" default = "us-east-1"
} }
@@ -11,7 +11,7 @@ variable "localstack_endpoint" {
} }
variable "project_name" { variable "project_name" {
description = "Short name of the fictional project." description = "Short name of the project."
type = string type = string
default = "quantum" default = "quantum"
} }
+6 -6
View File
@@ -40,7 +40,7 @@ resource "aws_s3_object" "sample_config" {
content = jsonencode({ content = jsonencode({
appName = "Quantum" appName = "Quantum"
environment = var.environment environment = var.environment
featureToggle = "simulated-localstack" featureToggle = "localstack"
owner = "platform-team" owner = "platform-team"
}) })
@@ -84,9 +84,9 @@ resource "aws_secretsmanager_secret_version" "quantum_app" {
secret_id = aws_secretsmanager_secret.quantum_app.id secret_id = aws_secretsmanager_secret.quantum_app.id
secret_string = jsonencode({ secret_string = jsonencode({
databaseUrl = "postgres://quantum_user:fake_password@quantum-${var.environment}-db.local:5432/quantum" databaseUrl = "postgres://quantum_user:change-me@quantum-${var.environment}-db.local:5432/quantum"
apiKey = "qtm_${var.environment}_fake_123456" apiKey = "qtm_${var.environment}_change_me"
jwtSecret = "localstack-only-secret-${var.environment}" jwtSecret = "change-me-${var.environment}"
}) })
} }
@@ -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 = "Simulated permissions for the Quantum Lambda function on LocalStack." description = "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 = "Fictional event processor for the Quantum application." description = "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"
+2 -2
View File
@@ -1,10 +1,10 @@
variable "project_name" { variable "project_name" {
description = "Short name of the fictional project." description = "Short name of the project."
type = string type = string
default = "quantum" default = "quantum"
} }
variable "environment" { variable "environment" {
description = "Fictional application environment." description = "Application environment."
type = string type = string
} }