Skip to content

Instantly share code, notes, and snippets.

@pivotaljohn
Last active April 17, 2020 21:20
Show Gist options
  • Save pivotaljohn/debe4596df5b4158c7c09f6f1841dd47 to your computer and use it in GitHub Desktop.
Save pivotaljohn/debe4596df5b4158c7c09f6f1841dd47 to your computer and use it in GitHub Desktop.
Loading data values from a JSON file

JSON is valid YAML. That is, YAML syntax is a superset of JSON syntax.

So, YAML parsers naturally parse JSON.

$ ytt --data-value-yaml "stable_config=$( cat stable_config.json )" -f cluster-template-paving.yaml -f values.yml

Note: the values.yml needs to be present for ytt at the time of writing because data values specified on the command-line are each applied as an overlay with default matching (i.e. matches exactly one node).

#@ load("@ytt:data", "data")
foo: #@ data.values.stable_config.vpc_id
#@data/values
---
stable_config: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment