HCL is HashiCorp's configuration language toolkit designed to create structured configuration formats that balance human readability with machine processability. Written in Go, it serves as the foundation for configuration parsing across HashiCorp's infrastructure-as-code tools and other command-line applications, particularly in the DevOps ecosystem. The repository represents major version 2 of HCL, which introduced a completely new parser and Go API that is incompatible with version 1, though both versions remain available through Go Modules for projects that need them.
The core design philosophy of HCL distinguishes it from generic serialization formats like JSON and YAML. Rather than treating configuration as arbitrary data serialization, HCL is purpose-built as a syntax and API for constructing domain-specific configuration languages. It attempts to occupy a middle ground between simple data formats and full programming languages, providing declarative logic capabilities without the complexity of general-purpose code. This approach enables applications to define expected configuration structures upfront, allowing HCL to validate conformance and provide meaningful error messages while returning high-level objects ready for application processing.
HCL supports two syntactic representations: a native syntax designed for human authoring and a JSON variant optimized for machine generation. The native syntax draws inspiration from libucl, nginx configuration files, and similar sources, emphasizing readability and writability. Both syntaxes map to the same underlying information model built around two primary concepts: attributes and blocks. This dual-syntax approach allows configuration to be provided as a mixture of human-authored native files and machine-generated JSON files while maintaining API consistency within calling applications.
The language includes an expression syntax enabling basic inline computation and, with application support, integration of variables and functions for more dynamic configuration scenarios. Applications can work directly with low-level attributes and blocks for advanced use cases or employ decoder packages to declaratively extract configuration into Go structs or dynamic value structures. The expression system extends to JSON through interpolation syntax, allowing arbitrary expressions within JSON strings despite JSON's native limitations.
Version 2.0 merged the capabilities of the original HCL 1.0 with those of HashiCorp's interpolation language HIL, creating a unified configuration language with robust expression support. This consolidation required a complete reimplementation with different architectural approaches to address rough edges in the original design and improve error handling capabilities.
According to GitGenius activity tracking, the repository shows median issue and pull request response latency of 2.8 hours across 36 tracked items, indicating active maintenance. The most frequently addressed issue categories are enhancements with 6 tracked items, hclwrite-related issues with 4 items, and bugs with 4 items. Primary contributors include apparentlymart with 34 tracked events, crw with 14 events, and bflad with 4 events. The repository maintains overlapping contributor relationships with opentofu/opentofu, golang/go, and jenkinsci/docker, reflecting its role as foundational infrastructure tooling.
HCL originated in HashiCorp Terraform and has evolved through contributions from multiple developers who ported parsers from yacc to pure Go and designed the merged language architecture. The toolkit provides both high-level and low-level APIs, allowing applications ranging from simple configuration parsing to complex declarative language implementations to leverage HCL's structured approach to configuration management.