Skip to content

add elasticache module#28

Merged
flybayer merged 4 commits into
mainfrom
bb-elasticache
Jun 17, 2026
Merged

add elasticache module#28
flybayer merged 4 commits into
mainfrom
bb-elasticache

Conversation

@flybayer

@flybayer flybayer commented Jun 17, 2026

Copy link
Copy Markdown
Member

Greptile Summary

This PR refactors the ElastiCache module's version API, splitting the single optional engine_version variable into two required variables — engine_major_version and engine_minor_version — and adds a new rvn-elasticache-definition.yml module definition for the Ravion platform. It also changes the engine default from "redis" to "valkey" and adds a replication_group_member_cluster_id output and tolist(member_clusters)[0] for per-cluster CloudWatch dimension targeting.

  • Version API split: engine_version (optional, null default) is replaced by engine_major_version and engine_minor_version (both required, no default); locals.tf combines them into local.engine_version and simplifies the parameter group family derivation.
  • New platform definition: rvn-elasticache-definition.yml maps all 50+ module inputs to Terraform variables for the Ravion UI, including the new version fields and a rich set of CloudWatch metric expressions.
  • CloudWatch dimension change: The alarm/metric dimension shifts from the replication group ID to the first member cluster ID via tolist(member_clusters)[0], enabling per-cluster metrics; the same pattern is exposed as a new replication_group_member_cluster_id output.

Confidence Score: 3/5

Not safe to merge until the breaking-change implications for existing callers are resolved — the default engine switch and required version variables will destroy existing deployments that relied on defaults or omitted engine_version.

Switching engine default from "redis" to "valkey" and making engine_major_version/engine_minor_version required with no defaults will force every existing caller that omitted these inputs to either update their config or face a plan-time error or an unintended engine-type replacement. These are destructive changes for any live deployment using the module with its previous defaults, and neither the README nor the module definition includes a migration guide.

cache/elasticache/variables.tf — the removal of the optional engine_version default and the engine default change are the source of the breaking-change risk for existing callers.

Important Files Changed

Filename Overview
cache/elasticache/variables.tf Splits engine_version (optional, defaulting null) into two required variables engine_major_version and engine_minor_version, and changes the engine default from "redis" to "valkey" — both are breaking changes for existing callers.
cache/elasticache/locals.tf Adds local.engine_version combining major/minor, simplifies parameter group family derivation, and switches CloudWatch dimension from replication_group.id to tolist(member_clusters)[0] — the set-to-list conversion has spec-undefined ordering.
cache/elasticache/outputs.tf Adds replication_group_member_cluster_id output and updates engine_version fallback to local.engine_version; the new output uses the same tolist(member_clusters)[0] pattern with undefined ordering.
cache/elasticache/elasticache.tf Swaps var.engine_version for local.engine_version in both the replication group and cluster resources — straightforward and correct.
cache/elasticache/rvn-elasticache-definition.yml New 871-line module definition YAML mapping all inputs to Terraform variables; mirrors the variable API change to major/minor version split; engine_minor_version is always required: true even for serverless caches where version is unused.
cache/elasticache/README.md Documentation updated for the major/minor version split; all examples correctly updated; inputs table reflects the new required variables.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["engine_major_version (required)\nengine_minor_version (required)"] --> B["local.engine_version\n= major.minor"]

    B --> C{Engine type?}
    C -->|redis/valkey| D["aws_elasticache_replication_group\nengine_version = local.engine_version"]
    C -->|memcached| E["aws_elasticache_cluster\nengine_version = local.engine_version"]
    C -->|redis/valkey + serverless| F["aws_elasticache_serverless_cache\n(version not used)"]

    A --> G["default_parameter_group_family\nredis7 / valkey9 / memcached1.6"]

    D --> H["member_clusters (set)"]
    H --> I["tolist(member_clusters)[0]\n⚠ undefined ordering"]
    I --> J["cloudwatch_dimension_value\n(CacheClusterId)"]
    I --> K["replication_group_member_cluster_id\n(output)"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["engine_major_version (required)\nengine_minor_version (required)"] --> B["local.engine_version\n= major.minor"]

    B --> C{Engine type?}
    C -->|redis/valkey| D["aws_elasticache_replication_group\nengine_version = local.engine_version"]
    C -->|memcached| E["aws_elasticache_cluster\nengine_version = local.engine_version"]
    C -->|redis/valkey + serverless| F["aws_elasticache_serverless_cache\n(version not used)"]

    A --> G["default_parameter_group_family\nredis7 / valkey9 / memcached1.6"]

    D --> H["member_clusters (set)"]
    H --> I["tolist(member_clusters)[0]\n⚠ undefined ordering"]
    I --> J["cloudwatch_dimension_value\n(CacheClusterId)"]
    I --> K["replication_group_member_cluster_id\n(output)"]
Loading

Comments Outside Diff (1)

  1. cache/elasticache/README.md, line 1 (link)

    P2 Root README.md not updated

    AGENTS.md states: "When adding, modifying, or removing modules: 1. Update the Module Directory table in the root README.md." This PR modifies the elasticache module's public API (removes engine_version, adds engine_major_version / engine_minor_version, changes the default engine), but the root README.md was not updated.

    Context Used: AGENTS.md (source)

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: cache/elasticache/README.md
    Line: 1
    
    Comment:
    **Root README.md not updated**
    
    `AGENTS.md` states: *"When adding, modifying, or removing modules: 1. Update the Module Directory table in the root README.md."* This PR modifies the elasticache module's public API (removes `engine_version`, adds `engine_major_version` / `engine_minor_version`, changes the default engine), but the root `README.md` was not updated.
    
    **Context Used:** AGENTS.md ([source](https://app.greptile.com/flightcontrol/github/flightcontrolhq/modules/-/custom-context?memory=79f61682-c3c3-4650-8eed-6406e8edd026))
    
    How can I resolve this? If you propose a fix, please make it concise.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Reviews (3): Last reviewed commit: "fixes" | Re-trigger Greptile

Context used:

  • Context used - AGENTS.md (source)

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Ravion Module Publish Plan

Dry run only. No Ravion API mutations were made.

Module Current Version New Version Description
rvn-elasticache n/a 0.1.0 Initial ElastiCache module definition

Diffs

rvn-elasticache n/a -> 0.1.0

--- remote
+++ compiled
-
+description: Creates and manages Amazon ElastiCache for Redis, Valkey, Memcached, or serverless Redis-compatible caches.
+name: ElastiCache
+type: rvn-elasticache

rvn-elasticache n/a -> 0.1.0

--- remote
+++ compiled
+inputs:
+  - id: network
+    immutable: true
+    label: VPC network
+    mapped_inputs:
+      - id: section_aws
+        label: AWS account & region
+        type: section
+      - default: << ref.input.aws_account_id >>
+        id: aws_account_id
+        immutable: true
+        label: AWS account
+        type: string
+        values: $values:ravion/aws_accounts
+      - default: << ref.input.aws_region >>
+        description: AWS region for this cache.
+        id: aws_region
+        immutable: true
+        label: Region
+        type: string
+        values: $values:aws/regions
+      - collapsible: true
+        default: << ref.input.execution_environment_id >>
+        description: Override the VPC, subnet, and security group for Terraform runners. Must use the same AWS account as selected above.
+        id: execution_environment_id
+        label: Terraform execution environment
+        type: string
+        values: $values:ravion/execution_environments
+      - id: section_vpc
+        label: VPC
+        type: section
+      - default: <<ref.stack.output.vpc_id>>
+        id: vpc_id
+        immutable: true
+        label: VPC ID
+        required: true
+        type: string
+      - add_button_label: Add private subnet ID
+        default: <<ref.stack.output.private_subnet_ids>>
+        description: Subnets for the ElastiCache subnet group or serverless cache. Use private subnets for normal cache deployments.
+        id: subnet_ids
+        immutable: true
+        label: Private subnet IDs
+        required: true
+        type: string_array
+    required: true
+    type: $ref:rvn-aws-network
+  - id: section_cache
+    label: Cache
+    type: section
+  - default: <<project.given_id>>-<<environment.given_id>>
+    description: Name prefix for all ElastiCache resources.
+    id: name
+    immutable: true
+    label: Name slug
+    patterns:
+      - message: 1-40 lowercase letters, numbers, and hyphens. Start and end with a letter or number.
+        pattern: ^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$
+    required: true
+    type: string
+  - id: section_version
+    label: Version
+    type: section
+  - default: valkey
+    description: Choose Valkey for Redis-compatible workloads with lower AWS pricing, Redis for Redis OSS compatibility requirements, or Memcached for simple non-persistent object caching without Redis data structures. AWS prices Valkey 20% lower than Redis OSS for node-based ElastiCache and 33% lower for Serverless, with a 90% lower Serverless minimum data storage size.
+    id: engine
+    immutable: true
+    label: Engine
+    required: true
+    type: string
+    values:
+      - description: Recommended default for Redis-compatible workloads. AWS prices Valkey 20% lower than Redis OSS for node-based caches and 33% lower for Serverless, with a 90% lower Serverless minimum data storage size.
+        label: Valkey
+        value: valkey
+      - description: Use when you specifically need Redis OSS engine compatibility or have an existing Redis OSS requirement.
+        label: Redis
+        value: redis
+      - description: Best for simple volatile object caching where you do not need Redis commands, persistence, replicas, or cluster-mode sharding.
+        label: Memcached
+        value: memcached
+  - description: Major engine version. Current latest major versions include Valkey 9, Redis OSS 7, and Memcached 1.6.
+    id: engine_major_version
+    immutable: true
+    label: Engine major version
+    placeholder: "9"
+    required: true
+    type: string
+  - description: Minor or patch version appended to the major version.
+    id: engine_minor_version
+    label: Engine minor version
+    placeholder: "0"
+    required: true
+    type: string
+  - default: true
+    description: Enable automatic minor engine version upgrades during the maintenance window.
+    id: minor_version_auto_upgrade_enabled
+    label: Auto minor version upgrades
+    show_when:
+      serverless_enabled: false
+    type: boolean
+  - id: section_size
+    label: Size & topology
+    type: section
+  - default: false
+    description: Create an ElastiCache Serverless cache instead of provisioned nodes. Supported for Redis and Valkey.
+    id: serverless_enabled
+    immutable: true
+    label: Serverless
+    show_when:
+      engine:
+        - redis
+        - valkey
+    type: boolean
+  - default: cache.t4g.micro
+    description: ElastiCache node size for provisioned clusters.
+    id: node_type
+    label: Node type
+    patterns:
+      - message: Node type must start with cache.
+        pattern: ^cache\..+
+    required: true
+    show_when:
+      serverless_enabled: false
+    type: string
+  - default: 1
+    description: Number of Memcached cache nodes.
+    id: num_cache_nodes
+    label: Cache nodes
+    max: 40
+    min: 1
+    show_when:
+      engine: memcached
+      serverless_enabled: false
+    type: number
+  - default: false
+    description: Enable cluster mode when one primary shard is not enough for your data size or throughput. Leave disabled for simpler Redis or Valkey deployments with one primary and optional replicas.
+    id: cluster_mode_enabled
+    label: Cluster mode
+    show_when:
+      engine:
+        - redis
+        - valkey
+      serverless_enabled: false
+    type: boolean
+  - default: 1
+    description: Number of Redis or Valkey shards. Use 1 when cluster mode is disabled.
+    id: num_node_groups
+    label: Node groups
+    max: 500
+    min: 1
+    show_when:
+      cluster_mode_enabled: true
+      engine:
+        - redis
+        - valkey
+      serverless_enabled: false
+    type: number
+  - default: 0
+    description: Number of replica nodes in each Redis or Valkey node group.
+    id: replicas_per_node_group
+    label: Replicas per node group
+    max: 5
+    min: 0
+    show_when:
+      engine:
+        - redis
+        - valkey
+      serverless_enabled: false
+    type: number
+  - collapsible: true
+    description: Port where the cache accepts connections. Leave blank for engine defaults.
+    id: port
+    label: Port
+    max: 65535
+    min: 1
+    type: number
+  - collapsible: true
+    default: ipv4
+    description: Network type for the replication group.
+    id: network_type
+    label: Network type
+    show_when:
+      serverless_enabled: false
+    type: string
+    values:
+      - label: IPv4
+        value: ipv4
+      - label: IPv6
+        value: ipv6
+      - label: Dual stack
+        value: dual_stack
+  - collapsible: true
+    default: ipv4
+    description: IP address discovery method.
+    id: ip_discovery
+    label: IP discovery
+    show_when:
+      serverless_enabled: false
+    type: string
+    values:
+      - label: IPv4
+        value: ipv4
+      - label: IPv6
+        value: ipv6
+  - id: section_security
+    label: Security
+    type: section
+  - default: true
+    description: Create a security group with ingress rules for this cache.
+    id: security_group_creation_enabled
+    label: Security group creation
+    type: boolean
+  - description: Existing security group ID to use when security group creation is disabled.
+    id: security_group_id
+    label: Security group ID
+    patterns:
+      - message: Security group ID must start with sg-.
+        pattern: ^sg-.+
+    required: true
+    show_when:
+      security_group_creation_enabled: false
+    type: string
+  - add_button_label: Add security group ID
+    description: Security groups allowed to connect to this cache.
+    id: allowed_security_group_ids
+    label: Allowed security groups
+    patterns:
+      - message: Security group ID must start with sg-.
+        pattern: ^sg-.+
+    placeholder: sg-...
+    type: string_array
+  - add_button_label: Add CIDR block
+    collapsible: true
+    description: IPv4 CIDR blocks allowed to connect to this cache.
+    id: allowed_cidr_blocks
+    label: Allowed IPv4 CIDR blocks
+    placeholder: 10.0.0.0/16
+    type: string_array
+  - add_button_label: Add IPv6 CIDR block
+    collapsible: true
+    description: IPv6 CIDR blocks allowed to connect to this cache.
+    id: allowed_ipv6_cidr_blocks
+    label: Allowed IPv6 CIDR blocks
+    placeholder: 2001:db8::/64
+    type: string_array
+  - collapsible: true
+    default: true
+    description: Enable TLS encryption for Redis and Valkey traffic.
+    id: transit_encryption_enabled
+    label: Transit encryption
+    show_when:
+      engine:
+        - redis
+        - valkey
+    type: boolean
+  - collapsible: true
+    default: true
+    description: Enable encryption at rest for Redis and Valkey.
+    id: at_rest_encryption_enabled
+    label: At-rest encryption
+    show_when:
+      engine:
+        - redis
+        - valkey
+    type: boolean
+  - collapsible: true
+    description: KMS key ARN for at-rest encryption. Leave blank to use the AWS managed key.
+    id: kms_key_arn
+    label: KMS key ARN
+    placeholder: arn:aws:kms:us-east-1:123456789012:key/abc-123
+    show_when:
+      at_rest_encryption_enabled: true
+      engine:
+        - redis
+        - valkey
+    type: string
+  - collapsible: true
+    default: true
+    description: Generate an AUTH token for Redis or Valkey when no token is provided. Requires transit encryption.
+    id: auth_token_enabled
+    label: AUTH token generation
+    show_when:
+      engine:
+        - redis
+        - valkey
+      transit_encryption_enabled: true
+    type: boolean
+  - collapsible: true
+    description: Optional explicit AUTH token. Leave blank to generate one when AUTH token generation is enabled.
+    id: auth_token
+    label: AUTH token
+    show_when:
+      engine:
+        - redis
+        - valkey
+      transit_encryption_enabled: true
+    type: string
+  - collapsible: true
+    default: 32
+    description: Length of the generated AUTH token.
+    id: auth_token_length
+    label: AUTH token length
+    max: 128
+    min: 16
+    show_when:
+      auth_token_enabled: true
+      engine:
+        - redis
+        - valkey
+      transit_encryption_enabled: true
+    type: number
+  - id: section_availability
+    label: Availability
+    show_when:
+      engine:
+        - redis
+        - valkey
+      serverless_enabled: false
+    type: section
+  - default: false
+    description: Enable automatic failover. Requires at least one replica.
+    id: automatic_failover_enabled
+    label: Automatic failover
+    show_when:
+      engine:
+        - redis
+        - valkey
+      serverless_enabled: false
+    type: boolean
+  - default: false
+    description: Enable Multi-AZ support for the replication group.
+    id: multi_az_enabled
+    label: Multi-AZ
+    show_when:
+      engine:
+        - redis
+        - valkey
+      serverless_enabled: false
+    type: boolean
+  - collapsible: true
+    default: false
+    description: Enable data tiering for r6gd or r7gd node types.
+    id: data_tiering_enabled
+    label: Data tiering
+    show_when:
+      engine:
+        - redis
+        - valkey
+      serverless_enabled: false
+    type: boolean
+  - id: section_backups
+    label: Backups
+    show_when:
+      engine:
+        - redis
+        - valkey
+    type: section
+  - default: 0
+    description: Number of days to retain automatic snapshots. Set to 0 to disable backups.
+    id: snapshot_retention_limit
+    label: Snapshot retention days
+    max: 35
+    min: 0
+    show_when:
+      engine:
+        - redis
+        - valkey
+      serverless_enabled: false
+    type: number
+  - collapsible: true
+    description: Daily UTC window for automatic snapshots.
+    id: snapshot_window
+    label: Snapshot window
+    placeholder: 05:00-09:00
+    show_when:
+      engine:
+        - redis
+        - valkey
+      serverless_enabled: false
+    type: string
+  - collapsible: true
+    description: Final snapshot name to create when deleting the replication group. 
... diff truncated ...

Comment thread cache/elasticache/variables.tf
Comment thread cache/elasticache/variables.tf
Comment thread cache/elasticache/variables.tf
@flybayer flybayer requested a review from mabadir June 17, 2026 21:55
@flybayer

Copy link
Copy Markdown
Member Author

@greptile

@flybayer

Copy link
Copy Markdown
Member Author

@greptile

@flybayer flybayer merged commit 9cedc86 into main Jun 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants