Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/31554.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:feature
Add support for the `universe_domain` parameter in the KMS backend. This allows Vault to work with GCP sovereign cloud environments requiring custom API domains.
```
16 changes: 15 additions & 1 deletion internalshared/configutil/kms.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,21 @@ func GetAzureKeyVaultKMSFunc(kms *KMS, opts ...wrapping.Option) (wrapping.Wrappe

func GetGCPCKMSKMSFunc(kms *KMS, opts ...wrapping.Option) (wrapping.Wrapper, map[string]string, error) {
wrapper := gcpckms.NewWrapper()
wrapperInfo, err := wrapper.SetConfig(context.Background(), append(opts, wrapping.WithDisallowEnvVars(true), wrapping.WithConfigMap(kms.Config))...)
localOpts := []wrapping.Option{
wrapping.WithDisallowEnvVars(true),
wrapping.WithConfigMap(kms.Config),
}
// Support optional "universe_domain" config to allow using non-standard GCP
// endpoints (sovereign clouds / custom GCP-like endpoints).
//
// This is intentionally opt-in: we only append WithUniverseDomain when a
// "universe_domain" value is present in the KMS config. Default behavior
// (no config) uses the public GCP domain (googleapis.com).
if ud, ok := kms.Config["universe_domain"]; ok && ud != "" {
localOpts = append(localOpts, gcpckms.WithUniverseDomain(ud))
}

wrapperInfo, err := wrapper.SetConfig(context.Background(), append(opts, localOpts...)...)
if err != nil {
// If the error is any other than logical.KeyNotFoundError, return the error
if !errwrap.ContainsType(err, new(logical.KeyNotFoundError)) {
Expand Down