Search code examples
amazon-web-servicesaws-resource-group

how to find IAM role in aws console Resource tag group?


I have create some resoruces and iam roles by terraform, and add tags to them. I'd like to find all the resource with specifiec tag, but the resoult didn't include the iam role, even I select "All supported resource types". And I find this page https://docs.aws.amazon.com/config/latest/developerguide/resource-config-reference.html, it didn't mention how to find iam role.

is there any method to finnd out the iam role.

PS:my gole is export all the resources created by terraform, as they are a lot of resources, so I don't want to filter the resouce by tags as I have add tags to every resouces.


Solution

  • According to https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/supported-services.html:

    at this time, you can tag only the following IAM resources using the Resource Groups Tagging API:

    • instance-profile
    • mfa
    • oidc-provider
    • policy
    • saml-provider
    • server-certificate

    I.e. Resource Groups Tagging API has no support for the roles atm. You need to get all roles aws iam list-roles and then get tags on role aws iam list-role-tags to filter roles by tags.