Skip to content
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

fix(appsync): Source APIs are not auto-merged by default #27025

Closed
wants to merge 3 commits into from
Closed

fix(appsync): Source APIs are not auto-merged by default #27025

wants to merge 3 commits into from

Conversation

frixaco
Copy link

@frixaco frixaco commented Sep 6, 2023

Creating Merged API does not auto-merge Source API's because it's Execution Role doesn't have enough permissions.
Gives broader (appsync:*) set of permissions for Merged API Execution Role to fix the issue.

Closes #26986.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Sets a broad set of permissions for Merged AppSync API Execution Role: `appsync:*` to allow auto-merging both by default and by setting `mergeType` to `AUTO_MERGE`.
@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Sep 6, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team September 6, 2023 05:30
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels Sep 6, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: c17691a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mrgrain
Copy link
Contributor

mrgrain commented Sep 6, 2023

@jumic Can you have a look at this?

Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appsync:* is probably too much. Can you enumerate the necessary permissions?

@aws-cdk-automation
Copy link
Collaborator

The pull request linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.

PRs must pass status checks before we can provide a meaningful review.

If you would like to request an exemption from the status checks or clarification on feedback, please leave a comment on this PR containing Exemption Request and/or Clarification Request.

@frixaco
Copy link
Author

frixaco commented Sep 6, 2023

Hi @rix0rrr. Yep, I can do that. I'll update permissions with only required ones.

@jumic
Copy link
Contributor

jumic commented Sep 6, 2023

@ndejaco2 also replied in the PR regarding wrong permissions:
#26895 (comment)

Please also check this comment.

I'm on vacation without notebook, so I can't test any fixes.

@ndejaco2
Copy link
Contributor

I am hoping to submit a change that will fix the bugs introduced here as well as refactor the change so that the source api association is itself an L2 construct that can also be used outside the merged api definition in case teams do that in different stacks. I plan to send a PR for this shortly.

@ndejaco2
Copy link
Contributor

I sent PR which will better address this: #27121

@mrgrain
Copy link
Contributor

mrgrain commented Sep 19, 2023

Closing in favor of #27121

@mrgrain mrgrain closed this Sep 19, 2023
mergify bot pushed a commit that referenced this pull request Sep 20, 2023
As part of supporting AppSync Merged APIs, this change introduces a standalone SourceApiAssociation construct for declaring a source api association between a source API and a Merged API. 

Why do we need a standalone construct?

* There are two potential deployment models when dealing with separate stacks/pipelines between the source API and Merged API: 1. Push model where the source API owners manage the association in their stack 2. Pull model where the associations are managed in the Merged API stack. 
* Having a standalone construct gives developers more flexibility while still handling all the IAM permission handling in a single place. 
* Developers can continue to use the GraphQLApi construct and declare the source api configuration all within a single construct as before. But, if they want to have the source api association as a standalone object this change gives them flexibility

I also fixed two issues related to IAM:
1. The resource for appsync:SourceGraphQL needs both the source api arn and the source api arn + "/*" to get all top level fields.
2. The merged api execution role also needs appsync:StartSchemaMerge if the association is using AUTO_MERGE. The fix here is preferred over existing PR: #27025

Closes #26986 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-appsync: "Auto-merge failed" when creating Merged AppSync API with Source API merge type set AUTO_MERGE
6 participants