Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 8b4889b

Browse files
committed
Move taken service account error to server
1 parent bdc68ca commit 8b4889b

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

internals/secrethub/service_aws_init.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
// Errors
2727
var (
2828
ErrInvalidAWSRegion = errMain.Code("invalid_region").Error("invalid AWS region")
29-
ErrRoleAlreadyTaken = errMain.Code("role_taken").Error("a service account with that IAM role already exists. Use the existing service account by assuming the role and passing the --identity-provider=aws flag. Or create a new service account with a different IAM role.")
3029
ErrInvalidPermissionPath = errMain.Code("invalid_permission_path").ErrorPref("invalid permission path: %s")
3130
ErrMissingRegion = errMain.Code("missing_region").Error("could not find AWS region. Supply using the --region flag or in the AWS configuration. See https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html for the AWS configuration files")
3231
)
@@ -136,9 +135,7 @@ func (cmd *ServiceAWSInitCommand) Run() error {
136135
}
137136

138137
service, err := client.Services().Create(cmd.repo.Value(), cmd.description, credentials.CreateAWS(cmd.kmsKeyID, cmd.role, cfg))
139-
if err == api.ErrCredentialAlreadyExists {
140-
return ErrRoleAlreadyTaken
141-
} else if err != nil {
138+
if err != nil {
142139
return err
143140
}
144141

internals/secrethub/service_gcp_init.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,7 @@ func (cmd *ServiceGCPInitCommand) Run() error {
128128
}
129129

130130
service, err := client.Services().Create(cmd.repo.Value(), cmd.description, credentials.CreateGCPServiceAccount(cmd.serviceAccountEmail, cmd.kmsKeyResourceID))
131-
if err == api.ErrCredentialAlreadyExists {
132-
return ErrRoleAlreadyTaken
133-
} else if err != nil {
131+
if err != nil {
134132
return err
135133
}
136134

0 commit comments

Comments
 (0)