Back to articles
Terraform HCL for Developers: Why It Feels Familiar and Strange

Terraform HCL for Developers: Why It Feels Familiar and Strange

via Dev.toUstun Ozgur

If you're coming to Terraform from Python, JavaScript, or Ruby, HCL can feel uncanny: familiar enough to read, strange enough to second-guess. You see list-like comprehensions, Ruby-ish blocks, and syntax that looks a bit like assignment without really behaving like a programming language. That is not accidental. HCL is a hybrid—a configuration language designed to be readable by humans and useful for describing infrastructure, relationships, and constraints. The mental shift that helps most is this: You are not writing a script that runs top to bottom. You are declaring a desired shape of infrastructure, and Terraform turns that declaration into a dependency graph, a plan, and an execution strategy. Once that clicks, most of HCL's weirdness starts to make sense. 1. It's a graph, not a script In Python or JavaScript, source order usually matters because execution is fundamentally sequential. In Terraform, block order does not define execution order. References between objects—and, when

Continue reading on Dev.to

Opens in a new tab

Read Full Article
2 views

Related Articles