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

aws - Remove matched statement for glue-catalog #5808

Merged
merged 6 commits into from Jun 4, 2020

Conversation

PratMis
Copy link
Collaborator

@PratMis PratMis commented May 28, 2020

This PR adds functionality to remove matched statement in glue-catalog resource policy.
Sample Policy

policies:
  - name: remove-glue-catalog-cross-account
     resource: glue-catalog
     filters:
       - type: cross-account
     actions:
       - type: remove-statements
          statement_ids: matched

I had to manually edit the external account_id in the policy since it gets replaced by the default account_id. Also, if there are no statements left in the policy, glue doesn't allow usage of put_resource_policy(), hence I had to use delete_resource_policy()

@PratMis PratMis changed the title Remove cross-account matched statement aws - Remove matched statement for glue-catalog May 28, 2020
Copy link
Collaborator

@JohnHillegass JohnHillegass left a comment

Choose a reason for hiding this comment

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

looks good @PratMis! Would it make sense to also add a modify-policy action as well, similar to what was done for SNS/SQS? I have a has statements filter in flight which might compliment it well later

@PratMis
Copy link
Collaborator Author

PratMis commented Jun 1, 2020

looks good @PratMis! Would it make sense to also add a modify-policy action as well, similar to what was done for SNS/SQS? I have a has statements filter in flight which might compliment it well later

Absolutely @JohnHillegass ! it would make sense to have it for catalog. I'll queue it up for follow up PRs. Thanks!

@PratMis PratMis requested a review from kapilt June 1, 2020 18:16
c7n/resources/glue.py Outdated Show resolved Hide resolved
c7n/resources/glue.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@kapilt kapilt left a comment

Choose a reason for hiding this comment

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

lgtm, thanks

@kapilt kapilt merged commit 54b4804 into cloud-custodian:master Jun 4, 2020
@PratMis PratMis deleted the gcatalog-rm-matched branch June 4, 2020 17:18
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

3 participants