hcl/README.md

52 lines
1.7 KiB
Markdown
Raw Normal View History

2014-07-31 19:49:26 +00: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.
2014-08-03 05:23:14 +00:00
HCL is also fully JSON compatible. That is, JSON can be used as completely
valid input to a system expecting HCL. This helps makes systems
interoperable with other systems.
2014-07-31 19:49:26 +00:00
HCL is heavily inspired by
[libucl](https://github.com/vstakhov/libucl),
nginx configuration, and others similar.
2014-08-01 17:38:44 +00:00
## Syntax
The complete grammar
[can be found here](https://github.com/hashicorp/hcl/blob/master/parse.y),
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:
2014-08-01 18:20:48 +00:00
`["foo", "bar", 42]`. Arrays can contain primitives
and other arrays, but cannot contain objects. Objects must
use the block syntax shown below.
2014-08-01 17:38:44 +00:00
2014-08-01 18:20:48 +00:00
Objects and nested objects are created using the structure shown below:
2014-08-01 17:38:44 +00:00
```
variable "ami" {
description = "the AMI to use"
}
```