When deploying a stack (child) which references resources within another stack (parent), it seems that sometimes a resource in the parent stack needs to be re-created, but this is not possible because the child stack is referencing that resource and therefore it cannot be deleted.
The stacks are being deployed at the same time via CloudFormation (CDK). Contrived example:
const { someParentResource } = new ParentStack(...);
new ChildStack(..., someParentResource);
Since the child stack depends on someParentResource
, if that resource needs to be created then the deployment will fail with an error:
Cannot delete export parent-stack:ExportsOutput...4c48840d... as it is in use by child-stack.
Given, again, that the stacks are being deployed together via a single call to cdk deploy
, is there any way to tell AWS that it's okay to re-create resources with dependencies? Otherwise, the solution is to ... tear down the entire child stack ... ?
When deploying a stack (child) which references resources within another stack (parent), it seems that sometimes a resource in the parent stack needs to be re-created, but this is not possible because the child stack is referencing that resource and therefore it cannot be deleted.
The stacks are being deployed at the same time via CloudFormation (CDK). Contrived example:
const { someParentResource } = new ParentStack(...);
new ChildStack(..., someParentResource);
Since the child stack depends on someParentResource
, if that resource needs to be created then the deployment will fail with an error:
Cannot delete export parent-stack:ExportsOutput...4c48840d... as it is in use by child-stack.
Given, again, that the stacks are being deployed together via a single call to cdk deploy
, is there any way to tell AWS that it's okay to re-create resources with dependencies? Otherwise, the solution is to ... tear down the entire child stack ... ?
1 Answer
Reset to default 0You can try with -e
parameter:
cdk deploy -e parentStack
-e:
--exclusively, -e BOOLEAN Only deploy requested stacks and don't include dependencies.