-
Notifications
You must be signed in to change notification settings - Fork 4k
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(apprunner): make Service
implement IGrantable
#26130
Conversation
* This method exposes the Instance Role after creating it if not set. | ||
* @returns iam.IRole | ||
*/ | ||
public obtainInstanceRole(): iam.IRole { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we instead made Service
implement IGrantable
? Then we could just do
things like
bucket.grantRead(service);
Service
implement IGrantable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add an addToRolePolicy
method? I'm also going to change this to a feat
. Adding the auto creation of the role should cause the integ test to update and we'll need a README update.
@@ -1052,6 +1053,7 @@ export class Service extends cdk.Resource { | |||
this.props = props; | |||
|
|||
this.instanceRole = this.props.instanceRole; | |||
this.grantPrincipal = this.instanceRole || new iam.UnknownPrincipal({ resource: this }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should just go ahead and create the role if the user doesn't provide it. I'm not sure why we try to only generate one if needed.
Service
implement IGrantable
Service
implement IGrantable
There was a problem hiding this 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.
Exemption request. |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
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. |
@corymhall I've implemented the requested changes. |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Implementing `IGrantable` for cases when it's needed to grant permissions to a `Service` instance. For example: ``` declare const bucket: IBucket; const service = new apprunner.Service(this, 'Service', { source: apprunner.Source.fromEcrPublic({ imageConfiguration: { port: 8000 }, imageIdentifier: 'public.ecr.aws/aws-containers/hello-app-runner:latest', }), }); bucket.grantRead(service); ``` Closes aws#26089. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Implementing
IGrantable
for cases when it's needed to grant permissions to aService
instance.For example:
Closes #26089.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license