vals icon indicating copy to clipboard operation
vals copied to clipboard

vault backend, parse json secrets

Open none0nfg opened this issue 2 years ago • 2 comments

Is it possible to parse JSON secrets from vault, and use JSON as an object in values files?

Now vals can parse json, but only 1 key (can't parse whole json secret), also parsed json pastes as a string.

Examples That is vault's secret data

"data": {
    "data": {
      "key1": {
        "myData": [
          "qwerty"
        ]
      },
      "key2": {
        "myData": [
          "uiop"
        ]
      }

Here is values.yaml

global:
  tag: ref+vault://engine/dir/secretName/key1

It will work. And the tag value would be like map[myData:[qwerty]] of the type String.

But it would be great to have an opportunity to process that data in templates.

Or maybe there is a way to parse a string to an object ?

none0nfg avatar Sep 18 '23 19:09 none0nfg

@none0nfg Hey! I build vals because I wanted a way to inject secrets into a yaml file without templating. So, I won't add support for templating.

However, a way to parse a string to an object would be a good addition to vals! Maybe it could be a per-ref-url option, something like &as=object or more generic &fn=parse_json.

mumoshu avatar Dec 01 '23 01:12 mumoshu