Skip to content

Commit

Permalink
fix: handle NoSuchEntity err on delete
Browse files Browse the repository at this point in the history
This was blocking cluster deletion, because the OIDC provider no longer existed and was returning an error.
  • Loading branch information
sl1pm4t committed Jul 23, 2024
1 parent b97c3fa commit 5956c87
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkg/cloud/services/iam/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"crypto/tls"
stderr "errors"
"fmt"
"github.com/aws/aws-sdk-go/aws/awserr"
"path"
"strings"

Expand Down Expand Up @@ -287,7 +288,20 @@ func deleteOIDCProvider(arn string, iamClient iamiface.IAMAPI) error {

_, err := iamClient.DeleteOpenIDConnectProvider(&input)
if err != nil {
return errors.Wrap(err, "error deleting provider")

var aerr awserr.Error
ok := errors.As(err, &aerr)
if !ok {
return errors.Wrap(err, "deleting OIDC provider")
}

switch aerr.Code() {
case iam.ErrCodeNoSuchEntityException:
return nil
default:
return errors.Wrap(err, "deleting OIDC provider")
}

}
return nil
}
Expand Down

0 comments on commit 5956c87

Please sign in to comment.