Skip to content

Commit

Permalink
Merge pull request #254 from Petersoj/elasticache-default-userid-fix
Browse files Browse the repository at this point in the history
fix(elasticache): use ID instead of name for default user filter
  • Loading branch information
ekristen authored Aug 21, 2024
2 parents 9b2b17d + 5c04628 commit b6f1842
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resources/elasticache-users.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package resources
import (
"context"
"fmt"
"strings"

"github.com/gotidy/ptr"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/elasticache"
Expand Down Expand Up @@ -71,7 +72,7 @@ func (l *ElasticacheUserLister) List(_ context.Context, o interface{}) ([]resour
}

func (i *ElasticacheUser) Filter() error {
if strings.HasPrefix(*i.userName, "default") {
if ptr.ToString(i.userID) == "default" {
return fmt.Errorf("cannot delete default user")
}
return nil
Expand Down

0 comments on commit b6f1842

Please sign in to comment.