-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(aws-appsync): addRdsDataSource doesnt support taking a DatabaseCluster #29302
(aws-appsync): addRdsDataSource doesnt support taking a DatabaseCluster #29302
Comments
Yes we should support that. I'm making it a feature request and we welcome any PRs from the community. aws-cdk/packages/aws-cdk-lib/aws-appsync/lib/graphqlapi-base.ts Lines 188 to 190 in d308818
|
### Issue # (if applicable) (aws-appsync): addRdsDataSource doesnt support taking a DatabaseCluster Closes #29302 ### Reason for this change AppSync CDK construct currently accept only IServerlessCluster for RDS source as cluster type. However, with Aurora V2, serverless aurora clusters such as postgres aurora v14 and above are construct using the DatabaseCluster construct and as such AppSync.addRdsDataSource() method need ability to support both type of cluster interfaces. ### Description of changes To support the change I created a second props to support IDatabaseCluster in addition to IServerlessCluster already supported and I overloaded the constructor to support both type of props. However, to make the change possible, some modification to aws-rds were also required: 1 - Need IDatabaseCluster interface to have grantDataApiAccess() method published as part of the interface (the method was there but not published in the interface, when IServerlessCLuster interface have it published. 2 - need DatabaseCluster.grantDataApiAccess() to follow the same IAM permission pattern than ServerlessCluster.grantDataApiAccess() to have consistency. ServerlessCluster.grantDataApiAccess() method is adding automatically the required permission to secret manager if Data API is enabled. However, DatabaseCluster.grantDataApiAccess() do not. As such without the change it will have been required for end users to add that IAM permission to secret manager as an extra line when they will have assigned a serverless V2 cluster to AppSync datasource. To keep the experience unified across the 2 type of RDS clusters, i updated the method to have that IAM permission embedded. ### Description of how you validated changes - Unit test created for the new feature - Unit test updated and validated for RDS changes - Integration test created for the new feature I run all unit test and the integration test successfully. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Describe the bug
Aurora V2 Serverless now supports the Data API but from researching online the CDK recommended way to create v2 database is using the DatabaseCluster construct.
The method
addRdsDataSource
part of Appsync does not allow us to pass the DatabaseCluster as a datasource.I think we should allow either DatabaseCluster or ServerlessCluster. Right now it seems only objects that implement
Iserverlesscluster
are allowed.Expected Behavior
Allow me to pass the DatabaseCluster to the addRdsDataSource method
Current Behavior
We're gonna try to use the L1 construct instead CfnDataSource as that just requires database information thats available in both constructs
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.130
Framework Version
No response
Node.js Version
v18.15.0
OS
MAC
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: