diff --git a/internal/util/kms.go b/internal/util/kms.go index bf9361a49..cd767e55c 100644 --- a/internal/util/kms.go +++ b/internal/util/kms.go @@ -67,7 +67,7 @@ func GetKMS(tenant, kmsID string, secrets map[string]string) (EncryptionKMS, err section, ok := config[kmsID] if !ok { return nil, fmt.Errorf("could not get KMS configuration "+ - "for %q", kmsID) + "for %q (have %v)", kmsID, getKeys(config)) } // kmsConfig can have additional sub-sections diff --git a/internal/util/util.go b/internal/util/util.go index a907fd745..c4d2b6ece 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -319,3 +319,17 @@ func contains(s []string, key string) bool { return false } + +// getKeys takes a map that uses strings for keys and returns a slice with the +// keys. +func getKeys(m map[string]interface{}) []string { + keys := make([]string, len(m)) + + i := 0 + for k := range m { + keys[i] = k + i++ + } + + return keys +}