Skip to content

A simple CLI that parses arbritrary JSON to the HCL format of tfvars files

License

Notifications You must be signed in to change notification settings

imjoshholloway/json2tfvars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json2tfvars

A simple CLI that parses arbritrary JSON to the HCL format of tfvars files.

Installation

go get github.com/imjoshholloway/json2tfvars

Usage

Pipe some json in:

echo '{ "string": "value", "object": { "key": { "subkey": "value" }, "key2": { "subkey2": "value" } }}' | json2tfvars

string = "value"
object = { key = { subkey = "value" }, key2 = { subkey2 = "value" } }

Alternatively pass in a json file:

json2tfvars -source=path/to/file.json

Why is this needed?

In versions of [terraform][#terraform] below the currently unreleased 0.12 nested maps in json variable files are not parsed correctly. This utility converts json payloads to the tfvars format in order to work around this issue.

See: hashicorp/terraform#15549 for more information

About

A simple CLI that parses arbritrary JSON to the HCL format of tfvars files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages