Describe the bug
If a stack maintains multiple cross-region exports, and some subset of cross-region exports are being imported by other stacks, attempting to remove any cross-region export value that is not being used (imported) by any deployed stack:
❯ cdk diff [...] --exclusively
[...]
[~] Custom::CrossRegionExportWriter ExportsWriteruswest2[...]
ExportsWriteruswest2[...]
└─ [~] WriterProps
└─ [~] .exports:
└─ [-] Removed: ./cdk/exports/unused-value/anotherstackuseast1Ref[...]certificate[...]
Fails with the following error on cdk deploy:
ExportsWriteruswest2[...]/Resource/Default (ExportsWriteruswest2[...]) Received response status [FAILED] from custom resource. Message returned: Error: Exports cannot be updated:
at throwIfAnyInUse (/var/task/index.js:4:10)
Other issues don't describe this bug:
Expected Behavior
CDK should fail to deploy with the error above only if the cdk diff shows an export being removed that is currently imported by another stack.
Current Behavior
CDK fails to deploy with the error above even when cdk diff shows only exports being removed that are not currently imported by another stack.
Reproduction Steps
- Create two cross-region exports, exported from stack A into another stack B in a different region.
- Remove one of the two imports from stack B and deploy stack B exclusively. Observe that one import is removed from stack B's
["CrossRegionExportReader"]["ReaderProps"] template in the CloudFormation console.
- Attempt to deploy stack A. Observe one of the two exports being removed in the diff. Observe that on the deploy, the ExportWriter fails to update and the deploy fails with the error above.
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.94.0 (build 987c329)
Framework Version
No response
Node.js Version
v18.17.1
OS
macOS
Language
Python
Language Version
Python (3.10.4)
Other information
No response
Describe the bug
If a stack maintains multiple cross-region exports, and some subset of cross-region exports are being imported by other stacks, attempting to remove any cross-region export value that is not being used (imported) by any deployed stack:
Fails with the following error on
cdk deploy:Other issues don't describe this bug:
Expected Behavior
CDK should fail to deploy with the error above only if the
cdk diffshows an export being removed that is currently imported by another stack.Current Behavior
CDK fails to deploy with the error above even when
cdk diffshows only exports being removed that are not currently imported by another stack.Reproduction Steps
["CrossRegionExportReader"]["ReaderProps"]template in the CloudFormation console.Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.94.0 (build 987c329)
Framework Version
No response
Node.js Version
v18.17.1
OS
macOS
Language
Python
Language Version
Python (3.10.4)
Other information
No response