HCL is a library for building human-friendly configuration languages with a native syntax and JSON equivalent. Applications define expected attributes and blocks, then parse and evaluate files through the API.
Overview
HCL targets command-line tools, servers, and devops software that need structured settings richer than flat JSON but lighter than a full programming language. Version 2 provides Go APIs for parsing, decoding, and evaluating configuration with expressions, variables, and functions when the host application supplies them.
Native syntax draws inspiration from nginx, libucl, and similar formats, emphasizing readable files. The same logical model can be authored in JSON for machine generation, enabling mixed human-edited and generated configs.
Callers declare which attribute names and nested block types are valid; HCL verifies structure and returns high-level objects for further processing. A lower-level API remains available for custom control over parsing and evaluation.
HCL is intentionally not a serialization format like YAML; it focuses on schema-aware configuration with clearer errors and defined structure per application.
Key features
- Native and JSON configuration syntax
- Attribute and block information model
- Inline expression language
- Go parsing and evaluation APIs
- Schema validation against expected structure
- Lower-level parser access
- Human-oriented config authoring
- Machine-friendly JSON variant
Use cases
- Terraform-style application configuration
- CLI tools with structured settings files
- Devops utilities defining nested resource blocks
- Mixed human and generated configuration inputs