Add GetFunction and GetPolicy permissions to the build image cleanup role#7087
Add GetFunction and GetPolicy permissions to the build image cleanup role#7087hgreebe merged 6 commits intoaws:developfrom
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.
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.
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
| {"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.
[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?
…role (aws#7087) * Add GetFunction and GetPolicy permissions to the build image cleanup role * Increase pcluster build image cleanup role revision number * Update CHANGELOG * Add unit test for actions in CleanupRole policy * Fix linter errors
…role (#7087) * Add GetFunction and GetPolicy permissions to the build image cleanup role * Increase pcluster build image cleanup role revision number * Update CHANGELOG * Add unit test for actions in CleanupRole policy * Fix linter errors
…role (aws#7087) * Add GetFunction and GetPolicy permissions to the build image cleanup role * Increase pcluster build image cleanup role revision number * Update CHANGELOG * Add unit test for actions in CleanupRole policy * Fix linter errors
…role (aws#7087) * Add GetFunction and GetPolicy permissions to the build image cleanup role * Increase pcluster build image cleanup role revision number * Update CHANGELOG * Add unit test for actions in CleanupRole policy * Fix linter errors
…role (aws#7087) * Add GetFunction and GetPolicy permissions to the build image cleanup role * Increase pcluster build image cleanup role revision number * Update CHANGELOG * Add unit test for actions in CleanupRole policy * Fix linter errors
…role (#7087) * Add GetFunction and GetPolicy permissions to the build image cleanup role * Increase pcluster build image cleanup role revision number * Update CHANGELOG * Add unit test for actions in CleanupRole policy * Fix linter errors
…role (aws#7087) * Add GetFunction and GetPolicy permissions to the build image cleanup role * Increase pcluster build image cleanup role revision number * Update CHANGELOG * Add unit test for actions in CleanupRole policy * Fix linter errors
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.