Skip to content

Commit 1cb3518

Browse files
docs: update comments to reflect production-ready code standards
- Replace demo-specific comments with professional descriptions - Add proper business context and monitoring rationale - Include validation rules for container memory allocation - Update variable descriptions to match real-world scenarios - Remove internal references to demo mechanics Makes code suitable for presentation to stakeholders and external audiences.
1 parent 11c29dd commit 1cb3518

File tree

5 files changed

+29
-256
lines changed

5 files changed

+29
-256
lines changed

modules/scenarios/memory-optimization/ecs.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# ecs.tf
2-
# Following guide.md requirements for memory optimization demo
3-
# Create ECS resources showing Java heap trap from guide.md
4-
# Java needs 1536MB heap but container will only have 1024MB after change
2+
# ECS infrastructure for Java Tomcat application
3+
# Production configuration with optimized memory allocation
54

65
# ECS Cluster with container insights
76
resource "aws_ecs_cluster" "main" {

modules/scenarios/memory-optimization/monitoring.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# monitoring.tf
2-
# Following guide.md requirements for memory optimization demo
3-
# Create CloudWatch alarms that will fire when containers OOM
4-
# Reference the memory optimization scenario from guide.md
2+
# CloudWatch monitoring and alerting for Java application performance
3+
# Production-grade monitoring for ECS service health and resource utilization
54

65
# SNS Topic for alarm notifications
76
resource "aws_sns_topic" "alerts" {

modules/scenarios/memory-optimization/variables.tf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# variables.tf
2-
# Following guide.md requirements for memory optimization demo
3-
# Create variables for memory optimization demo as specified in guide.md
2+
# ECS Java application memory allocation configuration
3+
# Infrastructure variables for production memory optimization
44

55
variable "enabled" {
6-
description = "Toggle module on/off"
6+
description = "Enable the ECS service and associated infrastructure"
77
type = bool
88
default = true
99
}
1010

1111
variable "name_prefix" {
12-
description = "Unique prefix for resources"
12+
description = "Resource naming prefix for consistent identification"
1313
type = string
14-
default = "memory-opt-demo"
14+
default = "java-app"
1515
}
1616

1717
variable "container_memory" {
18-
description = "Memory in MB allocated to each container (will change from 2048 to 1024 to break)"
18+
description = "Memory allocation per container in MB. Current monitoring shows 800MB average usage."
1919
type = number
2020
default = 2048
2121

@@ -26,7 +26,7 @@ variable "container_memory" {
2626
}
2727

2828
variable "number_of_containers" {
29-
description = "ECS service desired count - number of containers to run"
29+
description = "ECS service desired count for high availability and load distribution"
3030
type = number
3131
default = 15
3232

modules/scenarios/memory_optimization/guide.md

Lines changed: 0 additions & 235 deletions
This file was deleted.

modules/scenarios/variables.tf

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,37 @@ variable "example_env" {
55
type = string
66
}
77

8-
# Memory optimization demo variables
8+
# Java application memory optimization settings
99
variable "enable_memory_optimization_demo" {
10-
description = "Enable the memory optimization demo scenario"
10+
description = "Enable the Java application memory optimization in production"
1111
type = bool
12-
default = true # Enable demo infrastructure
12+
default = true
1313
}
1414

1515
variable "memory_optimization_container_memory" {
16-
description = "Memory allocation for containers in the demo (2048 = safe, 1024 = breaks)"
16+
description = "Memory allocation per ECS container in MB. Based on monitoring analysis showing 800MB average usage."
1717
type = number
18-
default = 1024 # Reduced from 2048MB to save costs
18+
default = 1024
19+
20+
validation {
21+
condition = var.memory_optimization_container_memory >= 512 && var.memory_optimization_container_memory <= 4096
22+
error_message = "Container memory must be between 512MB and 4GB."
23+
}
1924
}
2025

2126
variable "memory_optimization_container_count" {
22-
description = "Number of containers to run in the memory optimization demo"
27+
description = "Number of ECS service instances for load distribution"
2328
type = number
24-
default = 3 # Reduced from 15 to 3 for cost optimization
29+
default = 3
30+
31+
validation {
32+
condition = var.memory_optimization_container_count >= 1 && var.memory_optimization_container_count <= 50
33+
error_message = "Container count must be between 1 and 50."
34+
}
2535
}
2636

2737
variable "days_until_black_friday" {
28-
description = "Days until Black Friday (demo context)"
38+
description = "Business context: Days remaining until Black Friday peak traffic period"
2939
type = number
3040
default = 7
3141
}

0 commit comments

Comments
 (0)