Add path to iam_role in enumerator

main
Elie 2021-07-16 11:48:03 +02:00
parent 373bb0918b
commit 94d449b544
No known key found for this signature in database
GPG Key ID: 399AF69092C727B6
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)
},