Skip to content

fix(E3026): skip NumCacheClusters check for cluster mode groups sized by NodeGroupConfiguration or ReplicasPerNodeGroup - #4920

Merged
kddejong merged 1 commit into
aws-cloudformation:mainfrom
Varshith-Kali:fix-4856-e3026-cluster-sizing
Nov 2, 2026
Merged

kddejong merged 1 commit into
aws-cloudformation:mainfrom
Varshith-Kali:fix-4856-e3026-cluster-sizing

Conversation

@Varshith-Kali

Copy link
Copy Markdown
Contributor

Fixes #4856

E3026 reported "NumCacheClusters" must be greater than one for cluster mode AWS::ElastiCache::ReplicationGroup resources whenever NumNodeGroups was unset, even when the group was sized another way. Both templates in the issue deploy cleanly on CloudFormation, so these are false positives.

The CreateReplicationGroup API reference says of NumCacheClusters: "This parameter is not used if there is more than one node group (shard). You should use ReplicasPerNodeGroup instead." When a cluster mode group sets NodeGroupConfiguration, its shards are defined explicitly, and when it sets ReplicasPerNodeGroup, it is sized in cluster mode terms. In both cases NumCacheClusters does not apply, so the check now skips those groups. The AutomaticFailoverEnabled check in the same rule is untouched, and groups with none of NumNodeGroups, NodeGroupConfiguration, or ReplicasPerNodeGroup are still reported exactly as before.

Changes:

  • CacheClusterFailover: skip the NumCacheClusters check when NodeGroupConfiguration is set or ReplicasPerNodeGroup is present.
  • Regression coverage in the good fixture: a two shard group sized by NodeGroupConfiguration and a one shard group sized by ReplicasPerNodeGroup, mirroring both templates in the issue.

Verification:

  • New good fixture resources fail before the fix (both flagged E3026) and pass after.
  • test/unit/rules/resources/elasticache/: 14 passed.
  • test/unit/rules/resources/: 1353 passed.
  • Both templates from the issue pass cfn-lint --regions us-east-1 with no findings.

@Varshith-Kali

Copy link
Copy Markdown
Contributor Author

Hi maintainers, the workflow runs on this first-time contributor PR are waiting on approval. Could someone approve them when you get a chance? Thanks.

… by NodeGroupConfiguration or ReplicasPerNodeGroup

Fixes aws-cloudformation#4856

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
@kddejong
kddejong force-pushed the fix-4856-e3026-cluster-sizing branch from debc704 to 0e0717c Compare November 2, 2026 23:26
@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.74%. Comparing base (588d3c5) to head (0e0717c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4920   +/-   ##
=======================================
  Coverage   94.74%   94.74%           
=======================================
  Files         442      442           
  Lines       16145    16149    +4     
  Branches     3138     3140    +2     
=======================================
+ Hits        15296    15300    +4     
  Misses        469      469           
  Partials      380      380           
Flag Coverage Δ
unittests 94.73% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kddejong
kddejong merged commit 632a988 into aws-cloudformation:main Nov 2, 2026
24 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

2 participants