From c0323f102783484e19314b6445938ba15b2a0da7 Mon Sep 17 00:00:00 2001 From: Balazs Agoston Date: Wed, 6 Aug 2025 11:44:51 +0200 Subject: [PATCH 1/3] convert returned dbProxyNAme to lowercase and add tst cases --- packages/aws-cdk-lib/aws-rds/lib/proxy.ts | 2 +- .../aws-cdk-lib/aws-rds/test/proxy.test.ts | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-rds/lib/proxy.ts b/packages/aws-cdk-lib/aws-rds/lib/proxy.ts index 38f0f7ee36ed7..57491f41b39c4 100644 --- a/packages/aws-cdk-lib/aws-rds/lib/proxy.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/proxy.ts @@ -510,7 +510,7 @@ export class DatabaseProxy extends DatabaseProxyBase vpcSubnetIds: props.vpc.selectSubnets(props.vpcSubnets).subnetIds, }); - this.dbProxyName = this.resource.ref; + this.dbProxyName = this.resource.ref.toLowerCase(); this.dbProxyArn = this.resource.attrDbProxyArn; this.endpoint = this.resource.attrEndpoint; diff --git a/packages/aws-cdk-lib/aws-rds/test/proxy.test.ts b/packages/aws-cdk-lib/aws-rds/test/proxy.test.ts index c860d7bf23180..f034e7ec651b8 100644 --- a/packages/aws-cdk-lib/aws-rds/test/proxy.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/proxy.test.ts @@ -216,6 +216,27 @@ describe('proxy', () => { }); }); + test('dbProxyName property returns lowercase name', () => { + // GIVEN + const instance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ + version: rds.MysqlEngineVersion.VER_5_7, + }), + vpc, + }); + + // WHEN + const proxy = new rds.DatabaseProxy(stack, 'Proxy', { + dbProxyName: 'MyProxyName', + proxyTarget: rds.ProxyTarget.fromInstance(instance), + secrets: [instance.secret!], + vpc, + }); + + // THEN + expect(proxy.dbProxyName).toBe('myproxyname'); + }); + test('One or more secrets are required.', () => { // GIVEN const cluster = new rds.DatabaseCluster(stack, 'Database', { From 4191f85a733d43f1bbbcf386a014cfbbb37e5ce9 Mon Sep 17 00:00:00 2001 From: Balazs Agoston Date: Wed, 6 Aug 2025 13:26:49 +0200 Subject: [PATCH 2/3] Try avoid resource destroy --- packages/aws-cdk-lib/aws-rds/lib/proxy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-rds/lib/proxy.ts b/packages/aws-cdk-lib/aws-rds/lib/proxy.ts index 57491f41b39c4..1f05c3371ae42 100644 --- a/packages/aws-cdk-lib/aws-rds/lib/proxy.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/proxy.ts @@ -531,7 +531,7 @@ export class DatabaseProxy extends DatabaseProxyBase const proxyTargetGroup = new CfnDBProxyTargetGroup(this, 'ProxyTargetGroup', { targetGroupName: 'default', - dbProxyName: this.dbProxyName, + dbProxyName: this.resource.ref, dbInstanceIdentifiers, dbClusterIdentifiers, connectionPoolConfigurationInfo: toConnectionPoolConfigurationInfo(props), From 5714b4fc308e5ba1f4526b6db290f81b6d0bf966 Mon Sep 17 00:00:00 2001 From: Balazs Agoston Date: Wed, 6 Aug 2025 15:08:45 +0200 Subject: [PATCH 3/3] Remove testcase as it returns a token --- .../aws-cdk-lib/aws-rds/test/proxy.test.ts | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/packages/aws-cdk-lib/aws-rds/test/proxy.test.ts b/packages/aws-cdk-lib/aws-rds/test/proxy.test.ts index f034e7ec651b8..c860d7bf23180 100644 --- a/packages/aws-cdk-lib/aws-rds/test/proxy.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/proxy.test.ts @@ -216,27 +216,6 @@ describe('proxy', () => { }); }); - test('dbProxyName property returns lowercase name', () => { - // GIVEN - const instance = new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ - version: rds.MysqlEngineVersion.VER_5_7, - }), - vpc, - }); - - // WHEN - const proxy = new rds.DatabaseProxy(stack, 'Proxy', { - dbProxyName: 'MyProxyName', - proxyTarget: rds.ProxyTarget.fromInstance(instance), - secrets: [instance.secret!], - vpc, - }); - - // THEN - expect(proxy.dbProxyName).toBe('myproxyname'); - }); - test('One or more secrets are required.', () => { // GIVEN const cluster = new rds.DatabaseCluster(stack, 'Database', {