Intermediate HCL: Configuration Languages in HCL2
summary
Argues HCL2 is a language for domain-specific configuration languages, not just a data format, showing a Go-based parser using the HCL and cty libraries, environment-backed variables (PS_ prefix loader), over a hundred Terraform functions available, and user-defined functions (a parametric random selector with error handling). Demonstrates partial decoding of HCL bodies to implement polymorphic blocks (pets → cats/dogs), enforces required fields and type safety, and shows the toy deployment manifest and pet demo compile and error clearly when misconfigured.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 3:46HCL vs Other Tools
- 5:30Shared Context
- 6:48Three Techniques
- 8:40Lisa Mona
- 8:50Example
- 10:50Code
- 12:30Variables
- 13:10Tie Functions
- 14:22Decoding
- 15:43Environment variables
- 17:10Building environment variables
related talks
25mWhat's New in Terraform 0.12?
29mTesting Your HCL Modules for Terraform
34mThe Field Guide to Understanding Declarative Systems
19mConfig as Code
40mHow Terraform’s simple graph concepts deploy complex infrastructure as code
06mUnderstanding Configuration Issues in Storage Systems (Work-in-Progress Report)
05mLightning Talk: Reading Configuration Values When You Should Not Fail
18mEverything-as-Code: It's time to fix configurations
