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

Add has-specific-managed-policy filter to aws.lambda resource #8477

Merged
merged 3 commits into from Apr 12, 2023

Conversation

speshak
Copy link
Contributor

@speshak speshak commented Apr 10, 2023

No description provided.

@speshak speshak requested a review from kapilt as a code owner April 10, 2023 19:31
Copy link
Member

@ajkerrigan ajkerrigan left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good to me 👍 . Made one tweak (see comment inline) to reduce API call volume but unless you have any concerns with that we should be good to go.

Comment on lines +282 to +290
roles = {
r['Role']: {
'RoleName': r['Role'].split('/')[-1]
}
for r in resources
}

for role in roles.values():
self.get_managed_policies(client, [role])
Copy link
Member

Choose a reason for hiding this comment

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

This change allows us to consolidate list_attached_role_policies calls. In some local tests against a sandbox account where multiple Lambda functions share the same role, this produced the same resources.json results but with less than half the API calls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense to me, thanks for the improvement.

@ajkerrigan ajkerrigan merged commit f93c191 into cloud-custodian:main Apr 12, 2023
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants