hcl2json

command module
v0.0.0-...-a508f93 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2020 License: MIT Imports: 7 Imported by: 0

README

hcl2json

GitHub release Go Report Card Docker pulls

Get

Either download the appropriate binary from the Releases page, or run the following:

docker run --rm pbar1/hcl2json -- --help
Usage
hcl2json

Converts Hashicorp Configuration Langauge (HCL) to JavaScript Object Notation (JSON).
Can also output YAML and TOML. If multiple output format command line flags and/or
filename arguments are given, the rightmost wins. If no filename or - is given, reads
from stdin.'

Usage:
  hcl2json [FLAGS] [FILENAME]

Examples:
  Concatenate all Terraform files in a directory convert the result to JSON via stdin
  > cat *.tf | hcl2json

  Convert single HCL file to YAML
  > hcl2json -y example.hcl

Flags:
  -h, --help      help for hcl2json
  -v, --version   print program version
  -j, --json      output JSON (default)
  -y, --yaml      output YAML
  -t, --toml      output TOML
Example
♪ ~ cat <<EOF | hcl2json | jq
terraform {          
  required_version = "~> 0.12.0" 
}

resource "null_resource" "test" {}
EOF

Outputs the following...

{
  "resource": [
    {
      "null_resource": [
        {
          "test": [
            {}
          ]
        }
      ]
    }
  ],
  "terraform": [
    {
      "required_version": "~> 0.12.0"
    }
  ]
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL