-
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): delete should be done prioritized over create for the same resource type in the same context #27094
Comments
Curious if this is because the created resource and the resource to destroy are of different types. |
They are both AWS::Route53::RecordSet in the same construct. They only change I did was removing the word Public from the ID. Everything else is exactly the same. This is just one example, I've seen this before with other resources as well. |
This is just how CloudFormation works, we call this out in our docs:
Any sort of feature request on this isn't something we could consider, since we don't own CloudFormation and as such cannot do anything about this behavior. All we can do is document the behavior and recommend how to avoid the situation in the first place |
|
Describe the bug
I had to change the logical ID for an IP-RecordSet but it failed to create it because the A-Record already exists.
Checking the diff we can see that one will be destroyed and one will be created.
But they are executed in the opposite order.
Expected Behavior
I expect the delete to take place before the destroy, since if you have one create and one destroy, the created one should always be the end result. You cannot get a destroy action if you don't have an existing one. So there's only one logical outcome. If I'm not mistaken.
I understand that these are two different resources with no connections and I'm not trying to make it sound like an easy thing to fix.. But if they belong to the same service, and a called from the same context, it should be possible to analyze this scenario.
Current Behavior
The process tried to create the new resource before removing the old one causing an error.
Reproduction Steps
Possible Solution
In the cases where it's possible, prioritize the delete actions.
Additional Information/Context
No response
CDK CLI Version
2.95.0
Framework Version
No response
Node.js Version
18.14.1
OS
Windows 10 x64
Language
Typescript
Language Version
5.1.6
Other information
No response
The text was updated successfully, but these errors were encountered: