Skip to content

Instantly share code, notes, and snippets.

Last active April 17, 2020 21:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Referencing JSON data in a ytt template
$ ytt --data-value-file stable_config=stable_config.json -f cluster-template-paving.yaml -f values.yml

Note: the values.yml defines the stable_config data value. Without that declaration, the implied overlay from --data-value-file would fail. That is: values provided on the command-line overlay values from data value files.

#@ load("@ytt:data", "data")
#@ load("@ytt:json", "json")
#@ stable_config = json.decode(data.values.stable_config)
vpc_id: #@ stable_config["vpc_id"]
second_subnet_id: #@ stable_config["pks_subnet_ids"][1]
"vpc_id": "pete",
"pks_subnet_ids": [ 1, 2, 3 ]
stable_config: ~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment