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.71k stars 3.94k forks source link

servicecatalogappregistry: lookupFromName for application #20958

Open RichiCoder1 opened 2 years ago

RichiCoder1 commented 2 years ago

Describe the feature

The ability to lookup a Service Catalog AppRegistry Application via it's Name or Id.

Use Case

Once https://github.com/aws/aws-cdk/pull/20850 lands, it'll be possible to create a central "application" and then share it. This will enable creating multi-env deployments and associating them back to a single application. A possible solution to make this work is to bootstrap the SCAR App and then store the Arn in context, but to make it more "automatic" it'd be nice to define a name and then look it up.

Proposed Solution

AWS SC AppRegistry exposes an API to get applications by name: https://docs.aws.amazon.com/servicecatalog/latest/dg/API_app-registry_GetApplication.html.

Expose this as Application.fromLookupName(<name>) which returns a hydrated application that can then be used to associateStack.

For efficiencies sake, it might make sense to have an opt in behavior (either via prop or flag) to have the context key not be account/env specific for the likely to be more common case that there's a single application which is then shared across org (and therefore is technically unique).

Other Information

An alternative would be a way to write out the resulting ARN from creation directly to context, but I'm not sure that's possible and/or desired? If that's possible though, it could obviate the need for this.

Related, there was a neat idea proposed here which had the potential idea of using AppRegistry as an integrated primitive. This FR could potentially underpin that behavior for multi-stack applications.

Acknowledgements

CDK version used

2.30.0

Environment details (OS name and version, etc.)

N/A

peterwoodworth commented 2 years ago

Thanks for the request! We handle lookups in our cx-api library 🙂

I am marking this issue as p2, which means that we are unable to work on this immediately.

We use +1s to help prioritize our work, and are happy to revaluate this issue based on community feedback. You can reach out to the cdk.dev community on Slack to solicit support for reprioritization.

Check out our contributing guide if you're interested in contributing yourself - there's a low chance the team will be able to address this soon but we'd be happy to review a PR 🙂