Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

[WIP] Add tags to IAM Role Policy Attachment resource #663

Closed

Conversation

njtrettel
Copy link
Contributor

We're working on a use-case that requires us to filter IAM resources by their tags.

IAM roles are already filterable by tags
IAM policies will be filterable by tags starting with #662

However, if we don't delete the role or the policy, then we should also not remove the attachment. There is currently no way to filter out attachments based on the role they are attached to.

This PR adds a new field to the resource's properties, roleTag, which you can filter on.

A note about the tag property name

Since the attachment itself does not have any tags, I decided to use the tags from the role. To be more reflective of the actual resource, and to prevent confusion, I went with roleTag instead of tag. This means that in order to filter out an IAMRolePolicyAttachment by tag, you would need to do something like this instead (just use "roleTag"):

IAMRolePolicyAttachment:
  - property: "roleTag:SomeTagKey"
    value: "SomeTagValue"

Somebody could probably also convince me to add in the policy tags too...

@njtrettel njtrettel requested a review from a team as a code owner July 27, 2021 21:30
njtrettel and others added 3 commits July 28, 2021 08:56
Co-authored-by: Philipp Trulson <der-eismann@users.noreply.github.com>
@njtrettel njtrettel requested a review from der-eismann July 28, 2021 18:03
@njtrettel njtrettel changed the title Add tags to IAM Role Policy Attachment resource [WIP] Add tags to IAM Role Policy Attachment resource Jul 28, 2021
@njtrettel
Copy link
Contributor Author

putting a WIP on because this isn't working

the ListRoles api is not returning Tags like i thought it was, so i'll need to revisit this

@njtrettel
Copy link
Contributor Author

i ended up including these changes in #662 since they were so similar

@njtrettel njtrettel closed this Jul 30, 2021
@njtrettel njtrettel deleted the iam-role-policy-attachment-tags branch July 30, 2021 18:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants