Merge pull request #851 from cloudskiff/enrich_aws_iam_role

Add path to `iam_role` in enumerator
main
Elie 2021-07-20 18:23:44 +02:00 committed by GitHub
commit 0bb7acd3db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -54,7 +54,9 @@ func (e *IamRoleEnumerator) Enumerate() ([]resource.Resource, error) {
e.factory.CreateAbstractResource(
string(e.SupportedType()),
*role.RoleName,
map[string]interface{}{},
map[string]interface{}{
"path": *role.Path,
},
),
)
}

View File

@ -371,12 +371,15 @@ func TestIamRole(t *testing.T) {
repo.On("ListAllRoles").Return([]*iam.Role{
{
RoleName: aws.String("test_role_0"),
Path: aws.String("/"),
},
{
RoleName: aws.String("test_role_1"),
Path: aws.String("/"),
},
{
RoleName: aws.String("test_role_2"),
Path: aws.String("/"),
},
}, nil)
},
@ -389,12 +392,15 @@ func TestIamRole(t *testing.T) {
repo.On("ListAllRoles").Return([]*iam.Role{
{
RoleName: aws.String("AWSServiceRoleForOrganizations"),
Path: aws.String("/aws-service-role/organizations.amazonaws.com/"),
},
{
RoleName: aws.String("AWSServiceRoleForSupport"),
Path: aws.String("/aws-service-role/support.amazonaws.com/"),
},
{
RoleName: aws.String("AWSServiceRoleForTrustedAdvisor"),
Path: aws.String("/aws-service-role/trustedadvisor.amazonaws.com/"),
},
}, nil)
},