refactor(rds): read the read replica source ARN through AwsArnUtils.parse (#6887)

resolveReadReplicaSource split the source ARN by hand right under the looksLikeArn check. AwsArnUtils.parse gives the same partition, region, account and db:<name> resource; an ARN that is truncated, names another account or names a cluster still finds no source.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-28 22:20:13 -04:00
1 parent 63aa7710d0
commit 42e7f6f2f3
2 files changed
+18 -5

No files matched your search

@@ -10156,6 +10156,19 @@ class RdsServiceTest {
"a refused request leaves no dangling link on the source");
}
@Test
void createReadReplicaFindsNoSourceForAnArnThatIsNotThisAccountsInstance() {
createPostgresSource("primary");
for (String source : List.of("arn:aws:rds:us-east-1:123456789012:db",
"arn:aws:rds:us-east-1:999999999999:db:primary",
"arn:aws:rds:us-east-1:123456789012:cluster:primary")) {
AwsException notFound = assertThrows(AwsException.class, () ->
rdsService.createDbInstanceReadReplica(replicaRequest("r", source), null));
assertEquals("DBInstanceNotFound", notFound.getErrorCode(), source);
}
}
@Test
void createReadReplicaRollsBackWhenTheCopyFails() {
createPostgresSource("primary");