fork of https://github.com/hashicorp/hcl because issue : https://github.com/hashicorp/hcl/issues/290 these code permit use of "nested" field decoding which is just composite struct
Go to file
Mitchell Hashimoto bbf6292cbe Passing tests
2014-08-02 20:40:41 -07:00
ast Start the decoder 2014-08-02 15:44:45 -07:00
hcl Decode structures 2014-08-02 16:07:54 -07:00
json Start the decoder 2014-08-02 15:44:45 -07:00
test-fixtures Passing tests 2014-08-02 20:40:41 -07:00
.gitignore JSON parser 2014-08-02 11:38:41 -07:00
decoder_test.go Passing tests 2014-08-02 20:40:41 -07:00
decoder.go Decode structures 2014-08-02 16:07:54 -07:00
hcl_test.go Start the decoder 2014-08-02 15:44:45 -07:00
lex_test.go lexMode detects JSON 2014-08-01 12:54:53 -07:00
lex.go lexMode detects JSON 2014-08-01 12:54:53 -07:00
LICENSE LICENSE 2014-07-31 12:49:17 -07:00
Makefile hcl package for hcl parsing 2014-08-02 11:41:10 -07:00
parse.go parse 2014-08-02 11:44:14 -07:00
README.md Update README 2014-08-01 11:20:48 -07:00

HCL

HCL (HashiCorp Configuration Language) is a configuration language built by HashiCorp. The goal of HCL is to build a structured configuration language that is both human and machine friendly for use with command-line tools, but specifically targeted towards DevOps tools, servers, etc.

HCL is heavily inspired by libucl, nginx configuration, and others similar.

Syntax

The complete grammar can be found here, if you're more comfortable reading specifics, but a high-level overview of the syntax and grammar are listed here.

  • Single line comments start with # or //

  • Multi-line comments are wrapped in /* and */

  • Values are assigned with the syntax key = value (whitespace doesn't matter). The value can be any primitive: a string, number, boolean, object, or list.

  • Strings are double-quoted and can continue any UTF-8 characters. Example: "Hello, World"

  • Numbers are assumed to be base 10. If you prefix a number with 0x, it is treated as a hexadecimal. If it is prefixed with 0, it is treated as an octal.

  • Boolean values: true, false, on, off, yes, no.

  • Arrays can be made by wrapping it in []. Example: ["foo", "bar", 42]. Arrays can contain primitives and other arrays, but cannot contain objects. Objects must use the block syntax shown below.

Objects and nested objects are created using the structure shown below:

variable "ami" {
    description = "the AMI to use"
}