Skip to content

fix(rds): scope E3062 DBInstanceClass enum per engine - #4870

Merged
kddejong merged 1 commit into
aws-cloudformation:mainfrom
Varshith-Kali:fix-4853-rds-dbinstance-class-per-engine
Oct 27, 2026
Merged

kddejong merged 1 commit into
aws-cloudformation:mainfrom
Varshith-Kali:fix-4853-rds-dbinstance-class-per-engine

Conversation

@Varshith-Kali

Copy link
Copy Markdown
Contributor

Fixes #4853

Root cause

scripts/update_schemas_from_aws_api.py built the per-engine class data with dict.fromkeys(available_results.keys(), dict()), which hands every engine the same dict object. Every minor-version bucket then accumulated the union of all engines' orderable classes, so all 14 engines carried identical DBInstanceClass enums and branches for versions they do not even have (e.g. aurora-mysql had a branch for the MariaDB version 10.11). E3062 passed invalid engine/class/version combos, like mysql 5.7 on db.t4g.medium, which then fails at deploy time with CREATE_FAILED. This aliasing has been in the script since E3062 was added, so the data file was never correct.

Changes

  • scripts/update_schemas_from_aws_api.py: build a fresh dict per engine instead of sharing one via dict.fromkeys. Future regenerations (which need AWS credentials) will now produce correct per-engine data.
  • src/cfnlint/data/schemas/extensions/aws_rds_dbinstance/db_instance_class.json:
    • Dropped 842 branches that pair an engine with a minor version that engine does not have, keeping 138. Validity was checked against engine_version.json from the same data run (e.g. aurora-mysql now only has 5.7/8.0/8.4, mariadb only 10.5/10.6/10.11/11.4/11.8/12.3).
    • Scoped the mysql 5.7 enum to the 22 classes in the db.m5/db.r5/db.t3 families, which is what RDS offers for mysql 5.7.44 in us-east-1 per the issue (the docs also give db.t4g.medium on MySQL as 8.4 and 8.0). All currently available mysql 5.7 versions are 5.7.44-rds.* builds, so this covers the whole branch without false-positive risk.
  • test/unit/rules/resources/rds/test_db_instance_class_data.py: new regression tests.

Test evidence

  • New tests (5) written against the old data first: 3 failed as expected (repro template passed with no findings, mysql 5.7 enum contained db.t4g.medium, 842 cross-engine branches present), 2 passed.
  • After the fix: all 5 pass, and all 134 tests in test/unit/rules/resources/rds/ pass.
  • The issue's exact repro template (mysql, 5.7.44-rds.20260902, db.t4g.medium) now produces a single E3062 error; db.r5.large on the same engine/version and db.t4g.medium on mysql 8.0 still pass.
  • ruff check and ruff format --check clean on changed files. The JSON was rewritten with the generator's exact serialization settings, and a round-trip check on the original file confirmed byte stability, so the diff is purely the data correction.

Note

For minor versions shared by engines in the same family (e.g. mysql and aurora-mysql on 8.0, sqlserver flavors on 15.00), the enums remain the union across those engines, since I could not source the exact per-engine split without AWS API access. The script fix means the next regeneration with credentials will produce the exact per-engine enums. Nothing in this PR makes any currently passing valid combo fail: branch pruning only removed engine/version pairings the engine does not have, and the mysql 5.7 scoping matches the authoritative data in the issue.

@Varshith-Kali

Copy link
Copy Markdown
Contributor Author

Hi maintainers, the CI workflows on this PR are waiting on the first-time-contributor approval gate. Would appreciate an approval to run them when you get a moment. Happy to address any review feedback. Thanks!

@Varshith-Kali

Copy link
Copy Markdown
Contributor Author

Hi team, on this fix(rds) PR: the [CI] Test PR workflow run on the current head is still parked waiting for a first-time-contributor approval (action_required). Could a maintainer approve the run so CI can proceed? Thanks.

…class.json

The generator in scripts/update_schemas_from_aws_api.py built the
per-engine results with dict.fromkeys(available_results.keys(), dict()),
handing every engine the same dict object. Each minor-version bucket then
accumulated the union of all engines' orderable classes, so all 14 engines
carried identical enums and branches for versions they do not even have
(e.g. aurora-mysql had a MariaDB 10.11 branch). E3062 passed invalid
engine/class/version combos such as mysql 5.7 on db.t4g.medium.

Fix the generator to build a fresh dict per engine, drop the 842 branches
that pair an engine with a version it does not have (validated against
engine_version.json from the same data run), and scope the mysql 5.7 enum to
the db.m5/db.r5/db.t3 families RDS actually offers for mysql 5.7.44 in
us-east-1 (issue aws-cloudformation#4853). Add regression tests covering the issue repro, the
mysql 5.7 enum, and the cross-engine branch check.

Fixes aws-cloudformation#4853

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
@kddejong
kddejong force-pushed the fix-4853-rds-dbinstance-class-per-engine branch from 2ad7546 to 83df052 Compare October 27, 2026 22:24
@kddejong
kddejong merged commit edc9d45 into aws-cloudformation:main Oct 27, 2026
22 of 23 checks passed
@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.69%. Comparing base (8ec570a) to head (83df052).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4870   +/-   ##
=======================================
  Coverage   94.69%   94.69%           
=======================================
  Files         442      442           
  Lines       16083    16083           
  Branches     3119     3119           
=======================================
  Hits        15229    15229           
  Misses        470      470           
  Partials      384      384           
Flag Coverage Δ
unittests 94.68% <ø> (ø)

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.

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.

E3062: AWS::RDS::DBInstance DBInstanceClass enum is the same for all 14 engines, so mysql 5.7 on db.t4g.medium passes

2 participants