Skip to content

Commit 1894f2d

Browse files
authored
feat(AppSync): addRdsDataSource support for DatabaseCluster (#29544)
### 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*
1 parent f7d4f41 commit 1894f2d

23 files changed

+3798
-60
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
schema {
2+
query: Query
3+
mutation: Mutation
4+
}
5+
6+
type Query {
7+
getPost(id:ID!): Post
8+
allPosts: [Post]
9+
}
10+
11+
type Mutation {
12+
addPost(id: ID!, author: String!, title: String, content: String, url: String): Post!
13+
}
14+
15+
type Post {
16+
id: ID!
17+
author: String!
18+
title: String
19+
content: String
20+
url: String
21+
ups: Int
22+
downs: Int
23+
relatedPosts: [Post]
24+
relatedPostsMaxBatchSize: [Post]
25+
}

packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-rds-serverlessv2.js.snapshot/appsync-rds-serverlessV2.assets.json

+32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)