hcl2json

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

README

hcl2json

Go

Fork of https://github.com/tmccombs/hcl2json that simply splits the project into library and cmd.

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).

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.

Install

go get github.com/abiosoft/hcl2json/cmd/hcl2json@master

Usage

Usage: 
  -indent int
        number of spaces to indent with (default 2)
  -input string
        input HCL file. If missing, reads from stdin
  -output string
        output JSON file. If missing, writes to stdout

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

type Converter interface {
	ToJSON() (json []byte, err error)
}

Converter converts HCL to JSON.

func New

func New(hcl []byte) Converter

New creates a new HCL to JSON converter.

func NewIndent

func NewIndent(hcl []byte, indent int) Converter

NewIndent creates a new HCL to JSON converter with configured indent space.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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