Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
bugfix: skip NoSuchEntity error in iam.password_policies
Browse files Browse the repository at this point in the history
  • Loading branch information
yevgenypats committed Apr 7, 2021
1 parent aed1be5 commit 08ae755
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion resources/iam_password_policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package resources

import (
"context"

"errors"
"github.com/aws/aws-sdk-go-v2/service/iam"
"github.com/aws/aws-sdk-go-v2/service/iam/types"
"github.com/aws/smithy-go"
"github.com/cloudquery/cq-provider-aws/client"
"github.com/cloudquery/cq-provider-sdk/plugin/schema"
)
Expand Down Expand Up @@ -80,6 +81,10 @@ func fetchIamPasswordPolicies(ctx context.Context, meta schema.ClientMeta, paren
svc := meta.(*client.Client).Services().IAM
response, err := svc.GetAccountPasswordPolicy(ctx, &config)
if err != nil {
var ae smithy.APIError
if errors.As(err, &ae) && ae.ErrorCode() == "NoSuchEntity" {
return nil
}
return err
}
passwordPolicies = append(passwordPolicies, response.PasswordPolicy)
Expand Down

0 comments on commit 08ae755

Please sign in to comment.