diff --git a/pkg/provider/vault/vault.go b/pkg/provider/vault/vault.go index ca492185d..8609891b0 100644 --- a/pkg/provider/vault/vault.go +++ b/pkg/provider/vault/vault.go @@ -276,9 +276,6 @@ func (v *client) findSecretsFromTags(ctx context.Context, candidates []string, t if removeFromName != "" { name = strings.TrimPrefix(name, removeFromName) } - if _, exists := secrets[name]; exists { - return nil, fmt.Errorf(errDuplicateSecret, name) - } secrets[name] = secret } } @@ -300,9 +297,6 @@ func (v *client) findSecretsFromName(ctx context.Context, candidates []string, r if removeFromName != "" { name = strings.TrimPrefix(name, removeFromName) } - if _, exists := secrets[name]; exists { - return nil, fmt.Errorf(errDuplicateSecret, name) - } secrets[name] = secret } } diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 6bb8fc2b8..9dba79d21 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -60,7 +60,11 @@ func ConvertKeys(strategy esv1beta1.ExternalSecretConversionStrategy, in map[str newName[rk] = string(rv) } } - out[strings.Join(newName, "")] = v + key := strings.Join(newName, "") + if _, exists := out[key]; exists { + return nil, fmt.Errorf("secret name collision during conversion: %s", key) + } + out[key] = v } return out, nil }