We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3000373 commit 5844c77Copy full SHA for 5844c77
pkg/liqoctl/install/eks/iam.go
@@ -73,8 +73,15 @@ func (o *Options) ensureUser(iamSvc *iam.IAM) error {
73
UserName: aws.String(o.iamUser.userName),
74
}
75
76
- _, err := iamSvc.CreateUser(createUserRequest)
77
- if err != nil {
+ if _, err := iamSvc.CreateUser(createUserRequest); err != nil {
+ if aerr, ok := err.(awserr.Error); ok { //nolint:errorlint // we need to access methods of the aws error interface
78
+ switch aerr.Code() {
79
+ case iam.ErrCodeEntityAlreadyExistsException:
80
+ return fmt.Errorf("IAM user %v already exists, use --user-name flag to override it", o.iamUser.userName)
81
+ default:
82
+ return err
83
+ }
84
85
return err
86
87
0 commit comments