generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
feature-requestfeature requestfeature requesttriageto be triaged by project maintainersto be triaged by project maintainers
Description
Summary
Enhance the P4 Code Review module to give users flexibility in Redis deployment, allowing them to choose between:
- Internal (default) - Redis runs locally on the Swarm instance
- ElastiCache - Module provisions an AWS ElastiCache Redis cluster
- External - User provides their own Redis connection
Motivation
Different organizations have varying requirements for their caching infrastructure:
- Simplicity: Smaller deployments or dev environments may prefer Redis running on the same instance as Swarm
- Scalability: Production environments may need a dedicated ElastiCache cluster
- Existing Infrastructure: Some organizations have existing Redis deployments they want to reuse
Current State
The module currently provisions an ElastiCache cluster by default. This is a solid choice for production workloads requiring high availability and scalability, but it may not be the right fit for every use case. Users should have the flexibility to choose the deployment model that best suits their needs.
Proposed Changes
1. New Variable Structure
variable "redis_config" {
type = object({
mode = optional(string, "internal")
# ElastiCache options (used when mode = "elasticache")
node_type = optional(string, "cache.t3.micro")
node_count = optional(number, 1)
engine_version = optional(string, "7.0")
# External options (used when mode = "external")
host = optional(string)
port = optional(number, 6379)
})
default = {}
description = "Redis configuration. Mode can be 'internal' (local to instance), 'elasticache' (module-managed), or 'external' (user-provided)."
validation {
condition = contains(["internal", "elasticache", "external"], var.redis_config.mode)
error_message = "redis_config.mode must be 'internal', 'elasticache', or 'external'"
}
validation {
condition = var.redis_config.mode != "external" || var.redis_config.host != null
error_message = "redis_config.host is required when mode = 'external'"
}
}
Usage:
# Internal (default) - simplest setup
redis_config = {}
# ElastiCache - production setup
redis_config = {
mode = "elasticache"
node_type = "cache.r6g.large"
node_count = 2
}
# External - bring your own
redis_config = {
mode = "external"
host = "my-redis.example.com"
port = 6379
}
2. Implementation Changes
- Add Redis installation to AMI/instance setup for internal mode
- Make ElastiCache resources conditional on redis_mode = "elasticache"
- Update Swarm config.php templating to use appropriate Redis host
- Update security groups based on redis_mode
3. Documentation
- Document trade-offs between each mode
- Provide examples for each deployment pattern
Comparison
┌─────────────┬────────┬────────────┬─────────────┬──────────────────────────────┐
│ Mode │ Cost │ Complexity │ Scalability │ Use Case │
├─────────────┼────────┼────────────┼─────────────┼──────────────────────────────┤
│ Internal │ Lowest │ Simplest │ Limited │ Dev, small teams │
├─────────────┼────────┼────────────┼─────────────┼──────────────────────────────┤
│ ElastiCache │ Medium │ Medium │ High │ Production │
├─────────────┼────────┼────────────┼─────────────┼──────────────────────────────┤
│ External │ Varies │ Medium │ Varies │ Existing infra, shared Redis │
└─────────────┴────────┴────────────┴─────────────┴──────────────────────────────┘
Acceptance Criteria
- Default behavior changes to internal Redis (breaking change - document in release notes)
- Users can opt-in to ElastiCache with redis_mode = "elasticache"
- Users can connect to external Redis with redis_mode = "external"
- Security groups are correctly configured for each mode
- Documentation covers all three deployment patternsReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature-requestfeature requestfeature requesttriageto be triaged by project maintainersto be triaged by project maintainers
Type
Projects
Status
Backlog