Updating GCP secrets plugin (#10759)

* Update gcp secrets plugin pseudo tag
This commit is contained in:
Lauren Voswinkel 2021-01-26 09:35:49 -08:00 committed by GitHub
parent 1ecd3464eb
commit 508d33e64a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 5 deletions

2
go.mod
View File

@ -91,7 +91,7 @@ require (
github.com/hashicorp/vault-plugin-secrets-ad v0.8.0
github.com/hashicorp/vault-plugin-secrets-alicloud v0.7.0
github.com/hashicorp/vault-plugin-secrets-azure v0.8.0
github.com/hashicorp/vault-plugin-secrets-gcp v0.6.6-0.20201124222157-51537e030ec3
github.com/hashicorp/vault-plugin-secrets-gcp v0.6.6-0.20210121193032-bb12fd5092bd
github.com/hashicorp/vault-plugin-secrets-gcpkms v0.7.0
github.com/hashicorp/vault-plugin-secrets-kv v0.7.0
github.com/hashicorp/vault-plugin-secrets-mongodbatlas v0.2.0

4
go.sum
View File

@ -641,6 +641,10 @@ github.com/hashicorp/vault-plugin-secrets-azure v0.8.0 h1:3BAhoqqDN198vynAfS3rcx
github.com/hashicorp/vault-plugin-secrets-azure v0.8.0/go.mod h1:4jCVjTG809NCQ8mrSnbBtX17gX1Iush+558BVO6MJeo=
github.com/hashicorp/vault-plugin-secrets-gcp v0.6.6-0.20201124222157-51537e030ec3 h1:Nvc8t0AjBKD8vCvJvLBRDiPAOM9PRLnSMXX7Xkw5juY=
github.com/hashicorp/vault-plugin-secrets-gcp v0.6.6-0.20201124222157-51537e030ec3/go.mod h1:psRQ/dm5XatoUKLDUeWrpP9icMJNtu/jmscUr37YGK4=
github.com/hashicorp/vault-plugin-secrets-gcp v0.6.6-0.20210121193032-bb12fd5092bd h1:l+yD2mcdsZrtUhakzylE/7cMN6bJMZJU06l2w4MeXNA=
github.com/hashicorp/vault-plugin-secrets-gcp v0.6.6-0.20210121193032-bb12fd5092bd/go.mod h1:psRQ/dm5XatoUKLDUeWrpP9icMJNtu/jmscUr37YGK4=
github.com/hashicorp/vault-plugin-secrets-gcp v0.8.2 h1:iZDbNQnlNzwXnuUwOykQ54ReRmKc0VoxXz/b8V48EDM=
github.com/hashicorp/vault-plugin-secrets-gcp v0.8.2/go.mod h1:psRQ/dm5XatoUKLDUeWrpP9icMJNtu/jmscUr37YGK4=
github.com/hashicorp/vault-plugin-secrets-gcpkms v0.7.0 h1:dKPQIr6tLcMmhNKdc2A9pbwaIFLooC80UfNZL+jWMlA=
github.com/hashicorp/vault-plugin-secrets-gcpkms v0.7.0/go.mod h1:hhwps56f2ATeC4Smgghrc5JH9dXR31b4ehSf1HblP5Q=
github.com/hashicorp/vault-plugin-secrets-kv v0.7.0 h1:Sq5CmKWxQu+MtO6AXYM+STPHGnrGD50iKuwzaw87OVM=

View File

@ -199,6 +199,9 @@ func (b *backend) serviceAccountPolicyRollback(ctx context.Context, req *logical
p, err := r.GetIamPolicy(ctx, apiHandle)
if err != nil {
if isGoogleAccountNotFoundErr(err) || isGoogleAccountUnauthorizedErr(err) {
return nil
}
return err
}
@ -222,8 +225,10 @@ func (b *backend) deleteServiceAccount(ctx context.Context, iamAdmin *iam.Servic
}
_, err := iamAdmin.Projects.ServiceAccounts.Delete(account.ResourceName()).Do()
if err != nil && (!isGoogleAccountNotFoundErr(err) || !isGoogleAccountUnauthorizedErr(err)) {
return errwrap.Wrapf("unable to delete service account: {{err}}", err)
if err != nil {
if !isGoogleAccountNotFoundErr(err) && !isGoogleAccountUnauthorizedErr(err) {
return errwrap.Wrapf("unable to delete service account: {{err}}", err)
}
}
return nil
}
@ -297,11 +302,13 @@ func isGoogleApiErrorWithCodes(err error, validErrCodes ...int) bool {
if err == nil {
return false
}
gErr, ok := err.(*googleapi.Error)
ok := errwrap.ContainsType(err, new(googleapi.Error))
if !ok {
return false
}
gErr := errwrap.GetType(err, new(googleapi.Error)).(*googleapi.Error)
for _, code := range validErrCodes {
if gErr.Code == code {
return true

2
vendor/modules.txt vendored
View File

@ -570,7 +570,7 @@ github.com/hashicorp/vault-plugin-secrets-alicloud
github.com/hashicorp/vault-plugin-secrets-alicloud/clients
# github.com/hashicorp/vault-plugin-secrets-azure v0.8.0
github.com/hashicorp/vault-plugin-secrets-azure
# github.com/hashicorp/vault-plugin-secrets-gcp v0.6.6-0.20201124222157-51537e030ec3
# github.com/hashicorp/vault-plugin-secrets-gcp v0.6.6-0.20210121193032-bb12fd5092bd
github.com/hashicorp/vault-plugin-secrets-gcp/plugin
github.com/hashicorp/vault-plugin-secrets-gcp/plugin/iamutil
github.com/hashicorp/vault-plugin-secrets-gcp/plugin/util