All Projects → bertramdev → hcl4j

bertramdev / hcl4j

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

Programming Languages

java
68154 projects - #9 most used programming language
groovy
2714 projects
Lex
420 projects

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].