-
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
[core] Removing implicit references breaks deployment #9672
Comments
How can this class of problems be resolved? Just run into it again. My
|
A blog post from @skinny85 on the subject: https://www.endoflineblog.com/cdk-tips-03-how-to-unblock-cross-stack-references |
I think this problem has been raised before. As explained in the blog article you linked it can be handled with CfnOutputs. But for us it is a real show stopper. It is tedious and error prone. The problem is even worse when cdk must replace a dependency. You often end up with changing IDs because the old and new resources must exists at the same time. Even worse when you have a chain of dependencies like stack A depends on stack B which depends on stack C. Replacing a resource in C could break an output across the whole chain and you have to do the CfnOutput trick multiple times. I did, it's hard and time consuming. I think cdk should be able to sequence partial updates that would lead to the final desired state without errors. Now I understand that this could lead to partial state not consistent with the definition due to rollbacks not being possible. But I would be glad to have it has an option. At the very least some simple way of handling the CfnOutput trick could be a solution. This is really hard to drop cdk because of this problem. Apart from that it is really a great tool which could help us a lot. |
We've had a lot of problems with this. When e.g. renaming resources or moving from a stack to another. We also have a lot of context-based deployment options and for a true/false option this causes problems both ways when toggling. When removing a resource, CfnOutput is required, but if it's toggled on again that CfnOutput fails as duplicate for the implicit output. Would it be possible to allow the user to (optionally) control what resources are exposed as outputs? Something like |
|
I'm using CDK Pipelines to deploy two stacks, an
ApiStack
defining an AppSync API and aWebStack
defining a CloudFront distribution that makes the AppSync API available under a custom domain.Since the
WebStack
depends on theApiStack
, CDK Pipelines updates theApiStack
before it updates theWebStack
.Now, I decided to remove the AppSync API from the distribution. After removing the
graphQLApi
from theWebStack
, deployment fails with the CloudFormation error:I think the error is due to the fact that CDK is more clever (or rather, has complete knowledge) compared to the CloudFormation actions.
Since the CDK knows, that
ApiStack.graphQLApi
is no longer used, it removes the export from the stack. When updating theApiStack
, however, CloudFormation is not aware that theWebStack
(which is going to be updated in the next step) no longer imports theGraphQLApi
and fails deployment.I'm not sure how this kind of error can be fixed or prevented by the CDK ...
Reproduction Steps
Before change:
After change:
What did you expect to happen?
No error. The CodePipeline created by CDK Pipelines is able to deploy both stacks without error.
What actually happened?
Environment
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: