Created
July 2, 2018 11:45
-
-
Save nazarewk/4a4ec7ed0bd3aa497998abcf5b512afc to your computer and use it in GitHub Desktop.
Converts JSON values to terraform values (everything as strings)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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