feat(rds): refuse role feature names the engine does not support (#5637)

* feat(rds): refuse role feature names the engine does not support

AddRoleToDBInstance, AddRoleToDBCluster and CreateDBCluster
AssociatedRoles stored any FeatureName, so Lambda on a MySQL instance
was accepted although MySQL supports no role features.

A FeatureName now has to be one the engine lists in
SupportedFeatureNames, matched without regard to case, or the call is
InvalidParameterValue; CreateDBCluster refuses before any cluster
exists. A cluster role with no feature, and an engine the catalogue
does not list, are left alone. Aurora PostgreSQL also lists Bedrock,
which the Aurora user guide offers next to Comprehend and SageMaker.

Closes #5631

* refactor(rds): keep the two-argument cluster role check

Callers that check an AssociatedRoles list without knowing the engine,
such as the CloudFormation provisioner in #5656, keep the signature they
compile against; it runs the same checks without the feature check.

* fix(rds): match feature names without regard to case in every role check

The supported-feature check matched without regard to case, but the
instance duplicate check and both removal lookups compared exactly, so
an instance could take s3Import and then s3import as two roles. All of
them now match the same way. The two-argument cluster role check, which
nothing here calls, is removed.
This commit is contained in:
David authored and GitHub committed 2026-10-14 16:59:28 -04:00
1 parent a5228a0bf7
commit ff32bae98c
8 files changed
+250 -10

No files matched your search

@@ -790,6 +790,11 @@ class RdsControlPlaneTest {
.containsExactly(s3Role, lambdaRole);
assertThatThrownBy(() -> rds.addRoleToDBCluster(b -> b.dbClusterIdentifier(clusterName).roleArn(s3Role)))
.isInstanceOf(DbClusterRoleAlreadyExistsException.class);
// A feature the engine does not list in SupportedFeatureNames is refused.
assertThatThrownBy(() -> rds.addRoleToDBCluster(b -> b.dbClusterIdentifier(clusterName)
.roleArn("arn:aws:iam::000000000000:role/rds-sqlserver-s3").featureName("S3_INTEGRATION")))
.isInstanceOfSatisfying(RdsException.class,
e -> assertThat(e.awsErrorDetails().errorCode()).isEqualTo("InvalidParameterValue"));
rds.removeRoleFromDBCluster(b -> b.dbClusterIdentifier(clusterName).roleArn(s3Role));
assertThatThrownBy(() -> rds.removeRoleFromDBCluster(b -> b