From 516dd39f55f399ba10523d4881e7017baf4e02d3 Mon Sep 17 00:00:00 2001 From: Adam Moussa Date: Mon, 15 Jun 2026 10:59:24 -0400 Subject: [PATCH] fix(infra): give the Aurora cluster a distinct construct ID The RDS->Aurora swap (PR3 #125) kept construct ID 'Database', so CloudFormation saw the same logical ID change from AWS::RDS::DBInstance to AWS::RDS::DBCluster and rejected the changeset ('Update of resource type is not permitted'). Renaming the construct to 'AuroraCluster' gives the cluster a new logical ID, so CFN does a clean replace (remove old DBInstance, add new DBCluster) instead of an in-place type change. --- infra/lib/foundation-stack.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/infra/lib/foundation-stack.ts b/infra/lib/foundation-stack.ts index b2fa4ab..c5bb5ef 100644 --- a/infra/lib/foundation-stack.ts +++ b/infra/lib/foundation-stack.ts @@ -88,7 +88,11 @@ export class FoundationStack extends cdk.Stack { // PR3: replaced the RDS instance + OpenSearch Serverless with Aurora + pgvector // (kills the AOSS OCU floor; scales toward 0 ACU when idle). Data API is required // by Bedrock Knowledge Bases to query the vector table. - const dbCluster = new rds.DatabaseCluster(this, 'Database', { + // Construct ID is 'AuroraCluster' (not 'Database') so CloudFormation gets a NEW + // logical ID for the cluster — the old RDS DBInstance shared logical ID 'Database*' + // and CFN forbids changing a resource's type in place ("Update of resource type is + // not permitted"). A distinct ID makes it a clean replace instead. + const dbCluster = new rds.DatabaseCluster(this, 'AuroraCluster', { clusterIdentifier: `proposal-system-db${config.stackSuffix}`, engine: rds.DatabaseClusterEngine.auroraPostgres({ version: rds.AuroraPostgresEngineVersion.VER_15_4,