How to add a dynamic set of keys to a new yaml file? #1253
Replies: 5 comments
-
reopening as v4 issue. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug I want to create a yaml file with yaml keys defined dynamically at run time. Result in yaml: The tool is very feature rich, but I cannot seem to find a simple example of dynamic key creation. |
Beta Was this translation helpful? Give feedback.
-
I think you are looking for a variation of this https://mikefarah.gitbook.io/yq/operators/env-variable-operators#dynamic-key-lookup-with-environment-variable You can create entries like:
|
Beta Was this translation helpful? Give feedback.
-
may also be of interest |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
I've been Googling for awhile, and can't find a way to do this.
It seems like it should be simple, so I am missing something obvious.
I want to create a yaml file with yaml keys defined dynamically at run time.
Example:
environment variables: foo bar baz
Result in yaml:
.this.foo:
-- stuff here
.this.bar:
-- stuff here
.this.baz:
-- stuff here
The tool is very complicated, but I cannot seem to find an example of dynamic key creation
that would apply to this simple scenario. Hoping there is an easy answer I've overlooked.
Input Yaml
NONE
Beta Was this translation helpful? Give feedback.
All reactions