-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(CDK): Export changes prevent stack updates #17741
Comments
Hey @apmclean, thanks for opening the issue. This is a known problem with the CDK. This blog post explains how to unblock yourself in this situation. We have plans for solving this in the future permanently (for example, aws/aws-cdk-rfcs#309), but for now, you'll have to unblock yourself "manually". Thanks, |
Thanks for the details, I also found this buried at the bottom of the official AWS documentation in a round-about way for those who venture far enough into the bottom of the documentation. Is there any way to know the name that the CDK will create for an export in advance? ie: can I proactively include an Export() for any resource I might need to consume in the above layers but use the same name that the above layers would expect if they were synthed without my using Export() - ie: in consuming stacks I don't need to do my own fn::Imports. |
There's no way to know the name in advance, but you can call the |
Alright, I think if I'm going to put the effort into naming exports and managing all that between stacks, I'll just switch to using SSM parameters. Looser coupling. Thanks! |
|
What is the problem?
While creating a multi-stack app I am referring to resources between stacks. The CDK does a great job understanding those relationship automatically and creating an export for me.
However when a change is made in a stack that consumes resources where those resources are no longer used (in my case setting/updating Transit Gateway Routes) which have a level of dynamism based on routing traffic for inspection etc the CDK insists on deleting previous used (but now not) exports in the underlying stack.
This is blocked by CloudFormation which prevents the deletion of the stack. The 'stack above' cannot be updated because the 'stack below' doesn't export the resources it needs for the update. Both stacks are effectively 'locked' from updates.
Reproduction Steps
Deploy the following with a
cdk deploy --all
:After it has deployed successfully. Change line 59 to be
Private
instead ofPublic
. ie:Attempt to deploy changes. CDK will attempt to delete the RouteTableID exports for the public subnets in the Vpc Stack. This will be prevented because the TransitGateway Stack depends on them. Neither stack can be updated at this point.
What did you expect to happen?
The CDK would understand a previously used export was possibly / probably still in use and preserve it. I don't see a lot of value in deleting an existing export? Where an export has been created, I'd expect it to exist for the life-cycle of the stack.
Where that's not possible some kind of 'exportAll()' method on a construct would come in handy!
What actually happened?
CDK insists on deleting the now unused export which locks both stacks up preventing either from being updated.
CDK CLI Version
1.134.0 (build dd5e12d)
Framework Version
No response
Node.js Version
v14.18.1
OS
OSX 11.6.1
Language
Typescript
Language Version
3.9.10
Other information
No response
The text was updated successfully, but these errors were encountered: