Closed buzzerpuzzle closed 2 years ago
@buzzerpuzzle glad to hear about your interest in ytt
.
To template YAML ytt
can receive data values as you have discovered already. It offers a host of options for providing your values; those come roughly in two flavours:
--data-value*
#@data/values
)Depending on your situation you want to pick one, but you can mix and match to fit your needs.
As for --data-value-yaml
, it can only receive a single key. Let's say you have
#! test.yaml
#@ load("@ytt:data", "data")
values: #@ data.values
You could do
ytt -f test.yaml --data-value-yaml 'test={"test-1": "one", "test-2": "two"}'
and get
values:
test:
test-1: one
test-2: two
But I suggest not to use --data-value-yaml
as a general-purpose entry point for your values. Instead, I would like to refer you to "how to use data values" in the docs.
Feel free to ask more questions here, if you don't find that helpful! 🙇🏻
What a great answer, @mamachanko!!! So thorough! 🙇🏻
Thanks for this explanation, @mamachanko!
In my case, I would probably need to add multiple KV and I might not able to get rid of multiple --data-value-yaml
for this kind of case.
Hi team!
I'm starting to explore the ytt technology recently and I have quick question about ytt related usage.
I know I could pass two parameter with something like below command.
ytt -f variable.yml --data-value-yaml test=123 --data-value-yaml test2=456
And I feel its kind of redundant cause I got to type two
--data-value-yaml
Therefore, I am wondering is there anyway I could make it something like below so that I don't need to mention --data-value-yaml twiceytt -f variable.yml --data-value-yaml (test=123, test2=456)
orytt -f variable.yml --data-value-yaml {test=123, test2=456}
Thanks, Len