Treat Quantum as a real application
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 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:
|
||||
|
||||
@@ -13,9 +13,9 @@ https://localstack.paulononato.com.br
|
||||
- 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.
|
||||
- IAM role and policies for the Lambda function.
|
||||
- CloudWatch Log Group.
|
||||
- Secrets Manager secret with simulated credentials.
|
||||
- Secrets Manager secret with application configuration.
|
||||
- Event source mapping SQS -> Lambda.
|
||||
|
||||
## Repository Layout
|
||||
@@ -63,7 +63,7 @@ Choose an environment first:
|
||||
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:
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
variable "aws_region" {
|
||||
description = "Simulated AWS region in LocalStack."
|
||||
description = "AWS region used by LocalStack."
|
||||
type = string
|
||||
default = "us-east-1"
|
||||
}
|
||||
@@ -11,7 +11,7 @@ variable "localstack_endpoint" {
|
||||
}
|
||||
|
||||
variable "project_name" {
|
||||
description = "Short name of the fictional project."
|
||||
description = "Short name of the project."
|
||||
type = string
|
||||
default = "quantum"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
variable "aws_region" {
|
||||
description = "Simulated AWS region in LocalStack."
|
||||
description = "AWS region used by LocalStack."
|
||||
type = string
|
||||
default = "us-east-1"
|
||||
}
|
||||
@@ -11,7 +11,7 @@ variable "localstack_endpoint" {
|
||||
}
|
||||
|
||||
variable "project_name" {
|
||||
description = "Short name of the fictional project."
|
||||
description = "Short name of the project."
|
||||
type = string
|
||||
default = "quantum"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
variable "aws_region" {
|
||||
description = "Simulated AWS region in LocalStack."
|
||||
description = "AWS region used by LocalStack."
|
||||
type = string
|
||||
default = "us-east-1"
|
||||
}
|
||||
@@ -11,7 +11,7 @@ variable "localstack_endpoint" {
|
||||
}
|
||||
|
||||
variable "project_name" {
|
||||
description = "Short name of the fictional project."
|
||||
description = "Short name of the project."
|
||||
type = string
|
||||
default = "quantum"
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ resource "aws_s3_object" "sample_config" {
|
||||
content = jsonencode({
|
||||
appName = "Quantum"
|
||||
environment = var.environment
|
||||
featureToggle = "simulated-localstack"
|
||||
featureToggle = "localstack"
|
||||
owner = "platform-team"
|
||||
})
|
||||
|
||||
@@ -84,9 +84,9 @@ resource "aws_secretsmanager_secret_version" "quantum_app" {
|
||||
secret_id = aws_secretsmanager_secret.quantum_app.id
|
||||
|
||||
secret_string = jsonencode({
|
||||
databaseUrl = "postgres://quantum_user:fake_password@quantum-${var.environment}-db.local:5432/quantum"
|
||||
apiKey = "qtm_${var.environment}_fake_123456"
|
||||
jwtSecret = "localstack-only-secret-${var.environment}"
|
||||
databaseUrl = "postgres://quantum_user:change-me@quantum-${var.environment}-db.local:5432/quantum"
|
||||
apiKey = "qtm_${var.environment}_change_me"
|
||||
jwtSecret = "change-me-${var.environment}"
|
||||
})
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ resource "aws_iam_role" "quantum_lambda" {
|
||||
|
||||
resource "aws_iam_policy" "quantum_lambda" {
|
||||
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({
|
||||
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 = "Fictional event processor for the Quantum application."
|
||||
description = "Event processor for the Quantum application."
|
||||
role = aws_iam_role.quantum_lambda.arn
|
||||
runtime = "python3.11"
|
||||
handler = "handler.lambda_handler"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
variable "project_name" {
|
||||
description = "Short name of the fictional project."
|
||||
description = "Short name of the project."
|
||||
type = string
|
||||
default = "quantum"
|
||||
}
|
||||
|
||||
variable "environment" {
|
||||
description = "Fictional application environment."
|
||||
description = "Application environment."
|
||||
type = string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user