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

Commit 6958dd0

Browse files
committed
Only list user-managed Service Accounts
Other Service Accounts are not supported anyway, so no reason to list them.
1 parent 685c14a commit 6958dd0

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

internals/secrethub/service_gcp_init.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,19 @@ func (l *gcpServiceAccountOptionLister) Options() ([]ui.Option, bool, error) {
216216
return nil, false, gcp.HandleError(err)
217217
}
218218

219-
options := make([]ui.Option, len(resp.Accounts))
220-
for i, account := range resp.Accounts {
219+
var options []ui.Option
220+
for _, account := range resp.Accounts {
221+
if err := api.ValidateGCPServiceAccountEmail(account.Email); err != nil {
222+
continue
223+
}
221224
display := account.Email
222225
if account.Description != "" {
223226
display += " (" + account.Description + ")"
224227
}
225-
options[i] = ui.Option{
228+
options = append(options, ui.Option{
226229
Value: account.Email,
227230
Display: display,
228-
}
231+
})
229232
}
230233

231234
l.nextPage = resp.NextPageToken

0 commit comments

Comments
 (0)