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

Commit 56f38ba

Browse files
committed
Clarify filtering behaviour
1 parent 86f3788 commit 56f38ba

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
1818
github.com/pkg/errors v0.9.1 // indirect
1919
github.com/secrethub/demo-app v0.1.0
20-
github.com/secrethub/secrethub-go v0.29.1-0.20200703150346-411544a71e9d
20+
github.com/secrethub/secrethub-go v0.29.1-0.20200707154958-5e5602145597
2121
github.com/zalando/go-keyring v0.0.0-20190208082241-fbe81aec3a07
2222
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
2323
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ github.com/secrethub/secrethub-go v0.29.1-0.20200703092019-9f5d3de9b0e4 h1:TszZ+
174174
github.com/secrethub/secrethub-go v0.29.1-0.20200703092019-9f5d3de9b0e4/go.mod h1:tDeBtyjfFQX3UqgaZfY+H4dYkcGfiVzrwLDf0XtfOrw=
175175
github.com/secrethub/secrethub-go v0.29.1-0.20200703150346-411544a71e9d h1:tADItWP+YXaGLD1ZMFocxDaKKVcu8wXgEulbcUmX4Ec=
176176
github.com/secrethub/secrethub-go v0.29.1-0.20200703150346-411544a71e9d/go.mod h1:tDeBtyjfFQX3UqgaZfY+H4dYkcGfiVzrwLDf0XtfOrw=
177+
github.com/secrethub/secrethub-go v0.29.1-0.20200707154958-5e5602145597 h1:uC9ODMKaqBo1k8fxmFSWGkLr05TgEd3t4mHqJ8Jo9Gc=
178+
github.com/secrethub/secrethub-go v0.29.1-0.20200707154958-5e5602145597/go.mod h1:tDeBtyjfFQX3UqgaZfY+H4dYkcGfiVzrwLDf0XtfOrw=
177179
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
178180
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
179181
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=

internals/secrethub/service_gcp_init.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (cmd *ServiceGCPInitCommand) Run() error {
6868
serviceAccountLister := gcpServiceAccountOptionLister{
6969
ProjectID: projectID,
7070
}
71-
serviceAccountEmail, err := ui.ChooseDynamicOptionsValidate(cmd.io, "What is the email of the service account you want to use?", serviceAccountLister.Options, "service account", api.ValidateGCPServiceAccountEmail)
71+
serviceAccountEmail, err := ui.ChooseDynamicOptionsValidate(cmd.io, "What is the email of the service account you want to use?", serviceAccountLister.Options, "service account", api.ValidateGCPUserManagedServiceAccountEmail)
7272
if err != nil {
7373
return err
7474
}
@@ -90,7 +90,7 @@ func (cmd *ServiceGCPInitCommand) Run() error {
9090
}
9191

9292
if cmd.serviceAccountEmail == "" {
93-
serviceAccountEmail, err := ui.AskAndValidate(cmd.io, "What is the email of the GCP Service Account that should have access to the service?\n", 3, api.ValidateGCPServiceAccountEmail)
93+
serviceAccountEmail, err := ui.AskAndValidate(cmd.io, "What is the email of the GCP Service Account that should have access to the service?\n", 3, api.ValidateGCPUserManagedServiceAccountEmail)
9494
if err != nil {
9595
return err
9696
}
@@ -218,7 +218,8 @@ func (l *gcpServiceAccountOptionLister) Options() ([]ui.Option, bool, error) {
218218

219219
options := make([]ui.Option, 0, len(resp.Accounts))
220220
for _, account := range resp.Accounts {
221-
if err := api.ValidateGCPServiceAccountEmail(account.Email); err != nil {
221+
// Only list user-managed service accounts
222+
if err := api.ValidateGCPUserManagedServiceAccountEmail(account.Email); err != nil {
222223
continue
223224
}
224225
display := account.Email

0 commit comments

Comments
 (0)