-
Notifications
You must be signed in to change notification settings - Fork 314
Add GetFunction and GetPolicy permissions to the build image cleanup role #7087
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
base: develop
Are you sure you want to change the base?
Conversation
| PCLUSTER_BUILD_IMAGE_CLEANUP_ROLE_PREFIX = "PClusterBuildImageCleanupRole" | ||
| # Tag key & expected revision (increment when policy widens) | ||
| PCLUSTER_BUILD_IMAGE_CLEANUP_ROLE_REVISION = 1 | ||
| PCLUSTER_BUILD_IMAGE_CLEANUP_ROLE_REVISION = 2 |
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.
IIRC we need to increment only when we introduce breaking changes to the policy. This is an additive fix, not a breaking change. So I think we can keep the version to 1.
Can you please double check?
If this is the case, then please also fix the comment, as it could be misleading.
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.
Nope, I was wrong. We need to increase the version at every change, because we do not modify the exisitng role
See code
aws-parallelcluster/cli/src/pcluster/imagebuilder_utils.py
Lines 223 to 224 in e2d21fc
| if already_bootstrapped: | |
| return role_arn |
| {"Action": "tag:TagResources", "Resource": "*", "Effect": "Allow"}, | ||
| { | ||
| "Action": ["lambda:DeleteFunction", "lambda:RemovePermission"], | ||
| "Action": ["lambda:DeleteFunction", "lambda:RemovePermission", "lambda:GetFunction", "lambda:GetPolicy"], |
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.
[Test] I would expect a unit test to be adapted accordingly. If there is no unit test covering this part, can we add it to cover this change?
Description of changes
Tests
GetFunctionandGetPolicyactions no longer had AccessDenied errors.Please review the guidelines for contributing and Pull Request Instructions.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.