Skip to content

Latest commit

 

History

History
27 lines (16 loc) · 1.38 KB

README.md

File metadata and controls

27 lines (16 loc) · 1.38 KB

hcl2json

This is a tool to convert from HCL to json, to make it easier for non-go applications and scripts to process HCL inputs (such as terraform config).

If passed the -pack option, it converts to the JSON pack format used by hclpack, which contains the original structure of the document. However, all it has for expressions is the source text, which isn't always very useful.

If no options are passed, it converts the provide native HCL file to an (almost) equivalent HCL JSON file. Note, however, that there are some corner cases where it may not be exactly equivalent, especially if the target application makes use of static analysis.

Installation

Prebuilt binaries are available on the releases page. There is also a docker image on dockerhub.

Alternatively you can build from source (see next section).

Building

Unfortunately, go get doesn't seem to work this package (see #8).

Therefore you will need to clone and build the repository:

$ git clone https://github.com/tmccombs/hcl2json
$ cd hcl2json
$ go build

This will build an hcl2json library in the directory.