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

feat(redshift-alpha): implement IGrantable with a default service IAM Role #28018

Closed

Conversation

dontirun
Copy link
Contributor

Have Redshift Clusters implement the IGrantable interface with a default Service Role. This allows for easier permissioning for features like Redshift Spectrum.

Closes #28013


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

@github-actions github-actions bot added the valued-contributor [Pilot] contributed between 6-12 PRs to the CDK label Nov 16, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team November 16, 2023 00:12
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 labels Nov 16, 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.

Comment on lines 302 to 309
* A default AWS Identity and Access Management (IAM) role to be used by the cluster to access other AWS services.
*
* @default - Create a new role
*/
readonly serviceRole?: iam.IRole;

/**
* A list of additional AWS Identity and Access Management (IAM) roles that can be used by the cluster to access other AWS services.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Somewhat conflicted on whether this should even be a prop, but I am leaning towards having it since other services follow a similar pattern.

@dontirun
Copy link
Contributor Author

Exemption Request for a new integration test.

  1. All the old integration tests were affected by this change and they successfully ran.
  2. The unit tests should capture this functionality well

@aws-cdk-automation aws-cdk-automation added pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Nov 16, 2023
Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!
I left some suggestions for improvements on documentation and tests.
Also, I think that an integration test would be a good addition in this case.
Finally, the module in the title should be just redshift: feat(redshift): ....

packages/@aws-cdk/aws-redshift-alpha/lib/cluster.ts Outdated Show resolved Hide resolved
Comment on lines +464 to +467
/**
* A default AWS Identity and Access Management (IAM) role to be used by the cluster to access other AWS services.
*/
public readonly serviceRole: iam.IRole;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/**
* A default AWS Identity and Access Management (IAM) role to be used by the cluster to access other AWS services.
*/
public readonly serviceRole: iam.IRole;
/**
* A default AWS Identity and Access Management (IAM) role to be used by the cluster to access other AWS services.
*/
private readonly serviceRole: iam.IRole;

No need to make this public.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's useful to either make this public or add additional methods to allow users to add permissions to the role directly.

It's convenient for adding additional permissions beyond what grants provide. For example if I wanted to allow my cluster to read from a Glue Data Catalog.

packages/@aws-cdk/aws-redshift-alpha/lib/cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-redshift-alpha/lib/cluster.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-redshift-alpha/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-redshift-alpha/README.md Outdated Show resolved Hide resolved
@@ -779,6 +779,31 @@ describe('default IAM role', () => {
});

describe('IAM role', () => {

test('cluster instantiated with a default grantable IAM Role', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need unit tests for:

  • A Cluster with serviceRole specified via props
  • A Cluster with serviceRole and roles specified via props

@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 Nov 18, 2023
@dontirun
Copy link
Contributor Author

I think that an integration test would be a good addition in this case.

I can add one, but I'm not entirely sure what value an integration test specifically for this feature would add. The feature is already captured in all the other integration tests as the serviceRole gets created by default and added to the cluster. From a CloudFormation perspective the implementation just adds an additional role to the already existing list of roles.

dontirun and others added 2 commits November 18, 2023 14:44
Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 0fef007
  • Result: FAILED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, a couple of notes.

@aws-cdk-automation
Copy link
Collaborator

This PR has been in the CHANGES REQUESTED 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.

@natalie-white-aws
Copy link

Per Kendra's request, I reviewed these changes and can confirm that these changes do not conflict with the glue-alpha L2 work in flight. Safe to merge pending all other CDK service team checks without impacting our work.

@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 Dec 16, 2023
@aws-cdk-automation
Copy link
Collaborator

The pull request linter fails with the following errors:

❌ Features 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. valued-contributor [Pilot] contributed between 6-12 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-redshift-alpha: implement the IGrantable interface on Redshift Clusters
4 participants