Skip to content

Commit

Permalink
aws-dump: Added iam:instance-profiles report
Browse files Browse the repository at this point in the history
  • Loading branch information
hamstah committed Jul 30, 2019
1 parent b7c3df3 commit 3d88ac6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions aws/dump/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var (
"roles": IAMListRoles,
"policies": IAMListPolicies,
"groups": IAMListGroups,
"instance-profiles": IAMListInstanceProfiles,
},
}
)
Expand Down Expand Up @@ -239,3 +240,29 @@ func AttachServiceLastAccessedDetails(client *iam.IAM, result *ReportResult, job
i += 1
}
}

func IAMListInstanceProfiles(session *Session) *ReportResult {

client := iam.New(session.Session, session.Config)

resources := []Resource{}
err := client.ListInstanceProfilesPages(&iam.ListInstanceProfilesInput{},
func(page *iam.ListInstanceProfilesOutput, lastPage bool) bool {
for _, instanceProfile := range page.InstanceProfiles {
resource := Resource{
ID: *instanceProfile.InstanceProfileId,
ARN: *instanceProfile.Arn,
AccountID: session.AccountID,
Service: "iam",
Type: "instance-profile",
Region: *session.Config.Region,
Metadata: structs.Map(instanceProfile),
}
resources = append(resources, resource)
}

return true
})

return &ReportResult{resources, err}
}

0 comments on commit 3d88ac6

Please sign in to comment.