Skip to content
/ hcl4j Public
forked from bertramdev/hcl4j

HCL is the Hashicorp Configuration Language used in Terraform. This is a java Parser for parsing HCL and converting to Map objects.

Notifications You must be signed in to change notification settings

jimarek/hcl4j

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HCL4j

HCL4j is a Parser for the Hashicorp Configuration Language on the JVM. This provides a mechanism for converting HCL syntax into an Object Map that can be used for further inspection.

Features:

  • Support for Syntax parsing
  • Nested Array and Map support

Installation

Using gradle one can include the hcl4j dependency like so:

dependencies {
	compile "com.bertramlabs.plugins:hcl4j:0.4.0"
}

Whats New

  • 0.4.0 Primitive Types are now appended into the Map. These are of an extended PrimitiveType class. These Types include StringPrimitiveType, NumberPrimitiveType, BooleanPrimitiveType, MapPrimitiveType, and lastly ListPrimitiveType with a subType capable property.

Usage

Using the HCL Parser is fairly straightfoward. Most calls are still limited to use of the HCLParser class itself. There are several parse method helpers supporting both File, InputStream, String, and Reader as inputs.

import com.bertramlabs.plugins.hcl4j.HCLParser;

File terraformFile = new File("terraform.tf");
Map results = new HCLParser().parse(terraformFile, "UTF-8");

For More Information on the HCL Syntax Please see the project page:

https://github.com/hashicorp/hcl

Things to be Done

This plugin does not yet handle processing of the interpolated string syntax. While it does generate it into the result map, Parsing the values of the interpolation syntax needs to be done in a follow up step using some type of HCL runtime engine

About

HCL is the Hashicorp Configuration Language used in Terraform. This is a java Parser for parsing HCL and converting to Map objects.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 42.5%
  • Groovy 29.4%
  • Lex 28.1%