Skip to content

aws-rds: export value from network-stack cannot be deleted as it is in use by database-stack #26135

@mdesousa

Description

@mdesousa

Describe the bug

i have created a network stack with 3 subnets: one public, one private with egress, and one isolated.
in a separate database stack i'm creating a database cluster (Aurora Serverless V2 Postgres) and initially used the public subnet by setting vpcSubnets: { subnetType: SubnetType.PUBLIC }.

Now I would like to move the database to the isolated subnet by setting vpcSubnets: { subnetType: SubnetType.PRIVATE_ISOLATED }, however this results in an error: ExportsOutputRefnetworkstackvpcingressSubnet3SubnetCD2EA007C4DD55EA cannot be deleted as it is in use by database-stack.

I have tried doing a deployment that adds the new isolated subnets without removing the public ones, and that succeeded. But when I try to remove the public subnets I face the same error.

Expected Behavior

the cdk should be able to reassign the subnets without errors

Current Behavior

deployment fails with an error: ExportsOutputRefnetworkstackvpcingressSubnet3SubnetCD2EA007C4DD55EA cannot be deleted as it is in use by database-stack.

Reproduction Steps

create a vpc with public and isolated subnets.
create a database cluster in a vpc with vpcSubnets: { subnetType: SubnetType.PUBLIC }.
then deploy again with vpcSubnets: { subnetType: SubnetType.PRIVATE_ISOLATED }

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.85.0

Framework Version

No response

Node.js Version

18.15.0

OS

macOS

Language

Typescript

Language Version

TypeScript (5.1.3)

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-rdsRelated to Amazon Relational DatabasebugThis issue is a bug.effort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions