(AppSync): Add `GraphqlApi.fromApiName()` method to lookup existing APIs from other CDK projects
#13,440 opened on Mar 6, 2021
Description
Adding the static method fromApiName() to the GraphqlApi object will allow the configuration of APIs in separate projects.
Currently alternative is to use fromGraphqlApiAttributes which required knowledge of the exact ID or ARN used in the current environment, which is a configuration overhead for all projects to maintain and update the values across environments.
Use Case
We are setting up a number of graphQL end points that we would like to be reachable through a single CloudFront controlled URL.
The target end URL is services.domain.com with the following endPoints:
/endPoint1/endPoint2/endPoint3
etc
Each endPoint is serviced with different lamba functions that we would like to configure in separate projects, rather than build a single project with the lambdas for all end points. This will allow us to more easily manage the roll-out of different functions.
At the moment to do this we need to collect the IDs for each GraphqlApi once they are generated in the main project and then configure them per environment in each lambda project.
This API would simplify things.
Proposed Solution
GraphqlApi.fromApiName(scope: Construct, id: string, apiName: string): IGraphqlApi
Similar to the way a Bucket can be looked up:
Bucket.fromBucketName(scope: Construct, id: string, bucketName: string): IBucket
Other
- :wave: I may be able to implement this feature request
- :warning: This feature might incur a breaking change
This is a :rocket: Feature Request