Cannot remove cross-stack reference in a single cdk deploy (Export/Import deadlock) #38371
andresliszt
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi! I love cdk, thanks for this tool.
When a
ChildStackreferences an attribute from aParentStack(e.g., using a Parent resource property inside a Child's Lambda Function environment variable), AWS CDK automatically creates an implicit CloudFormation Export/Import.If I refactor the code to remove this reference by deleting the usage in theChildStackAND removing the property from theParentStacksimultaneously, cdk deploy fails. CloudFormation attempts to update theParentStackfirst (removing the exported Output) while theChildStackstill relies on it, causing a deployment blockage due to the export being in use.What is the recommended best practice to remove this cross-stack reference in a
single deploymentpipeline execution? OR the official (recommended) way to it is just apply targeting theChildStackstack alone and after a second deployment to updateParentStack?As user, I think this tool has to be smart enough to detect that is safe to delete from parent in a single deployment.
All reactions