aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.35k stars 3.77k forks source link

Synth: Drive application flow based on missing resources #29321

Open rupe120 opened 4 months ago

rupe120 commented 4 months ago

Describe the feature

Be able to manage (try/catch ?) missing resources from lookups, to be able to skip sections on a first pass if they don't exist yet.

Use Case

At the moment the way that I handle missing resources is to have configuration options, and fill in the values after the resources have been created. The creation of dependent resources is then based on the existence of a value in the configuration.

This is done to avoid Import/Export parameters that create a hard dependency between stacks. When there is a complex set of stacks and a structural change is needed, it is often the case that the dependent stack need to be manually deleted if an export parameter would be deleted in the new structure.

Proposed Solution

Optionally throw an exception on lookup failures. Alternatively a null object could be returned from the lookup.

I would see this a configurable option that could be turned on if desired.

Other Information

I am open to helping to make this happen. I would just need a little support in getting started. I have previously stood up the repository in a dev container, but the processes and structure is a lot to digest.

Acknowledgements

CDK version used

2.130.0 (build bd6e5ee)

Environment details (OS name and version, etc.)

Windows 11 22H2 22621.3007

pahud commented 4 months ago

Sounds like a good idea. Would love to see more sample snippets about the implementation.