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(amplify): add the default amplify policy to the auto-generated role #29076

Closed
wants to merge 2 commits into from

Conversation

johnf
Copy link
Contributor

@johnf johnf commented Feb 12, 2024

Issue # (if applicable)

Closes #28986

Reason for this change

The default created role for the Amplify App has no managed policy applied. So it can't do things like pull details of the backend config.

Description of changes

I've attached the Managed policy AdministratorAccess-Amplify which is what happens when you create an Amplify application in the console.

Description of how you validated changes

I've added unit tests.

Checklist


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

@aws-cdk-automation aws-cdk-automation requested a review from a team February 12, 2024 00:57
@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Feb 12, 2024
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.

@johnf johnf force-pushed the amplify-alpha-default-policy-on-role branch from b408d78 to 5402ad5 Compare February 12, 2024 01:01
@johnf johnf marked this pull request as draft February 12, 2024 04:11
@johnf johnf force-pushed the amplify-alpha-default-policy-on-role branch from 5402ad5 to c6db37b Compare February 12, 2024 04:42
@johnf
Copy link
Contributor Author

johnf commented Feb 12, 2024

I've also updated the customRule integ to set a status.
Even though according to the docs status isn't required, cloudformation errors if it isn't provided

@johnf johnf marked this pull request as ready for review February 12, 2024 04:43
@johnf johnf changed the title Add the default amplify policy to the autogenerated role fix(amplify): Add the default amplify policy to the auto-generated role Feb 12, 2024
@johnf johnf changed the title fix(amplify): Add the default amplify policy to the auto-generated role fix(amplify): add the default amplify policy to the auto-generated role Feb 12, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review February 12, 2024 04:54

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Feb 12, 2024
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

Hi @johnf, thanks for the contribution. I'm not sure if we want to add this set of permissions to the role. I came to this conclusion independent of @pahud, so that is a pretty strong signal for me. I'm going to close this PR as something we are not willing to accept in its current iteration. Lets discuss with @pahud and myself on the issue if you want to figure something out.

@@ -224,6 +224,7 @@ export class App extends Resource implements IApp, iam.IGrantable {

const role = props.role || new iam.Role(this, 'Role', {
assumedBy: new iam.ServicePrincipal('amplify.amazonaws.com'),
managedPolicies: [iam.ManagedPolicy.fromAwsManagedPolicyName('AdministratorAccess-Amplify')],
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm down to add common sense permissions to this role, but I balk at the idea of adding this managed policy. We typically don't like adding managed policies to our roles in CDK, and instead opt for fine grained controls (so our users know exactly what policy they are adding.

As always, if you want to use AdministratorAccess-Amplify, you can easily add it in as your role. But I don't want to push that on to everyone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's precisely the conversation I wanted to have in the issue before creating a PR :)
I can try to develop a smaller set of permissions, i.e., the minimum required to deploy a basic app. But I might miss some key things I'm not using myself.
The main thing missing for me was permission to talk to the backend to grab the amplify configuration.

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense and I'm wary of my initial disdain towards the black box of the managed policy. Just need someone to confirm w me.

@kaizencc kaizencc closed this Feb 12, 2024
@kaizencc
Copy link
Contributor

Hmm I've had an instant change of heart and will source another opinion :). Stay with me @johnf

@kaizencc kaizencc reopened this Feb 12, 2024
@johnf
Copy link
Contributor Author

johnf commented Feb 12, 2024

I'm not sure if we want to add this set of permissions to the role.

I think it's key that something is added to support amplify apps. Even if we define some prebaked permissions that someone can use or at a minimum add something to the documentation.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

1 similar comment
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@johnf
Copy link
Contributor Author

johnf commented Feb 28, 2024

@kaizencc Any more thoughts on this?
I need to update for conflicts but only want to spend the time if this or something similar is going to be approved

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

2 similar comments
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

2 similar comments
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR has been in the MERGE CONFLICTS state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

@aws-cdk-automation
Copy link
Collaborator

This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error.

@aws-cdk-automation aws-cdk-automation added the closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. label Mar 17, 2024
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Mar 17, 2024
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. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(amplify-alpha): The default created role is empty
3 participants