core: pluggable/cross-region NestedStack #26814
Labels
@aws-cdk/core
Related to core CDK functionality
effort/large
Large work item – several weeks of effort
feature-request
A feature should be added or improved.
p2
Describe the feature
Extend NestedStack functionality to allow changing the resulting implementation(CfnStack) with other (custom)resource/construct to allow different implementation without having to workaround the token resolving mechanism that is done on stack level.
It would allow for a custom resource to be used, that deploys the stack cross region and exposing the stack outputs as outputs of custom resource without having to workaround or add additional writers/readers to pass value cross-region.
That functionality might be built into cdk or user can implement this functionality for their use case and hook into cdk through NestedStack hook.
Use Case
It is frustrating to work with cdk in cross-region scenarios and the currently builtin solutions are mostly experimental or finicky to use.
In cloudformation/cdk we can easily add nested stacks with the NestedStack construct. cdk handles the inputs and outputs, generating template, publishing it etc all transparently. In case of rollback the nested stack is also attempted to be rolled back.
For certain resources like Cloudfront certain referenced resources like lambda@edge, Waf, certificates all must be deployed in us-east-1. Cdk contains a lot of custom resources and workarounds to make certain constructs easier to use in a cross-region manner.
Most of them are not easily extendable or are finicky to use, mainly because the reference resolving and linking is all on stack level and the resource need to create in mechanism to detect and workaround this resolving.
It would also open the cross-region functionality more easily for more resources than having such functionality having to be built in into every resource type.
Proposed Solution
Extend NestedStack so that a different resource than CfnStack like a custom resource that deploy stack in different region.
That custom resource might even be provider through cdk itself and be used if NestedStack is provided different env than the containing stack.
Other Information
No response
Acknowledgements
CDK version used
2.92.0
Environment details (OS name and version, etc.)
Ubuntu 22.04
The text was updated successfully, but these errors were encountered: