Skip to content

Commit

Permalink
fix: Improve IAM Policy sync performance (#2826)
Browse files Browse the repository at this point in the history

#### Summary

This PR adds in server side filtering so that the API doesn't try to get a lot of data that we never use.

In local tests I saw reduction in time from 10 seconds down to 2 seconds
  • Loading branch information
bbernays committed Oct 17, 2022
1 parent 9346279 commit 13d4689
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/source/aws/resources/services/iam/policies_fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import (
)

func fetchIamPolicies(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error {
var config iam.GetAccountAuthorizationDetailsInput
config := iam.GetAccountAuthorizationDetailsInput{
Filter: []types.EntityType{
types.EntityTypeAWSManagedPolicy, types.EntityTypeLocalManagedPolicy,
},
}
svc := meta.(*client.Client).Services().IAM
for {
response, err := svc.GetAccountAuthorizationDetails(ctx, &config)
Expand Down

0 comments on commit 13d4689

Please sign in to comment.