The HashiCorp configuration language
open sourceMPL-2.0free
HCL (HashiCorp Configuration Language) is a toolkit for building structured configuration languages that people and machines can both read and write, aimed mainly at devops tools and servers. It has a native syntax of attributes and nested blocks, inspired by libucl and nginx configuration, plus a JSON-based variant for machine-generated files, and an expression syntax for inline computation; the application that embeds it defines the expected structure and the variables and functions available. It's the language of Terraform and OpenTofu files, among other HashiCorp tools. This listing covers the specification and its Go implementation (github.com/hashicorp/hcl/v2, HCL 2, whose Go API is incompatible with version 1). MPL-2.0 licensed.
Libraries for HCL
Talira doesn't list any yet.
Problems it solves
- a human-friendly config file format for my command-line tool or server
- parse structured config with blocks and expressions in my Go program
- which config language should my devops tool use instead of YAML
- generate or edit Terraform-style configuration files programmatically
Features
- native syntax of attributes and nested blocks
- JSON-based variant for machine-generated configuration
- expression syntax with application-provided variables and functions
- application-defined schemas with clear error messages
- Go API from a simple decoder (hclsimple) down to low-level parsing
- hclwrite for generating and editing HCL files
- a written specification
Capabilities
| Has official SDKs | plan not known |
|---|
Alternatives
The same job
These do what HCL does.
- Pkl A configuration-as-code language with rich validation and tooling
- CUE Validate, define, and use dynamic and text-based data
- Jsonnet A configuration language for app and tool developers
- KCL An open-source constraint-based record and functional language for configuration and policy
- Starlark A Python dialect designed as a configuration language, made for Bazel
- Nickel Better configuration for less