-
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
fix(lambda): unable to add permissions to imported lambda functions #8828
Conversation
[ACTIONABLES]
|
Right now my logic is to just make everything that is imported to be aws-cdk/packages/@aws-cdk/aws-lambda/lib/function-base.ts Lines 182 to 187 in 9ee61eb
I think it's a valid point that imported Lambdas could potentially be from different accounts thus an inability to create resource policies. I suggest implementing something similar to the way aws-cdk/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts Lines 95 to 98 in 9ee61eb
This would require implementing another function and updating the README, but wouldn't interfere with the current implementation of @nija-at Open to suggestions to an alternative and will revisit fresh tomorrow morning. |
…asing" This reverts commit f3c77e3.
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.
Logic looks good. Some code comments.
Thank you for contributing! Your pull request will be updated from master 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 master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
PR #8828 added the ability to add permissions on imported functions, if the account on the stack and imported function matched. However, when this doesn't match, attempting to call `grantInvoke` on the imported function results in a `findChild` error. This change guards against calling `addPermission` when `canCreatePermissions` is false by checking if the `CfnPermission` was actually created, and adjusting the return from `addInvoke` appropriately. fixes #10607
PR #8828 added the ability to add permissions on imported functions, if the account on the stack and imported function matched. However, when this doesn't match, attempting to call `grantInvoke` on the imported function results in a `findChild` error. This change guards against calling `addPermission` when `canCreatePermissions` is false by checking if the `CfnPermission` was actually created, and adjusting the return from `addInvoke` appropriately. fixes #10607
PR #8828 added the ability to add permissions on imported functions, if the account on the stack and imported function matched. However, when this doesn't match, attempting to call `grantInvoke` on the imported function results in a `findChild` error. This change guards against calling `addPermission` when `canCreatePermissions` is false by checking if the `CfnPermission` was actually created, and adjusting the return from `addInvoke` appropriately. fixes #10607 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
[ISSUE]
Imported Lambda functions unable to add new resource policy
[APPROACH]
Add a check for imported Lambda Functions between the account id and the account id from imported Lambda Function. If they match, imported function can add permissions.
Fixes #7588
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license