Skip to content

Instantly share code, notes, and snippets.

@nazarewk
Created July 2, 2018 11:45
Show Gist options
  • Save nazarewk/4a4ec7ed0bd3aa497998abcf5b512afc to your computer and use it in GitHub Desktop.
Save nazarewk/4a4ec7ed0bd3aa497998abcf5b512afc to your computer and use it in GitHub Desktop.
Converts JSON values to terraform values (everything as strings)
def nullString: (
if . == null then "" else . end
);
def terraformify: ( .. |=
if type == "object" then
to_entries | map(.value |= nullString) | from_entries
elif type == "array" then
map(nullString)
elif . == true then
"1"
elif . == false then
"0"
else
tostring
end
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment