🏗️ Terraform / IaC
Beginner
What is HCL (HashiCorp Configuration Language)?
Answer
HCL (HashiCorp Configuration Language) is the configuration language used by Terraform (and other HashiCorp tools). It is designed to be both human-readable and machine-parseable. Key syntax elements: Blocks: define resources, providers, variables, outputs. resource "aws_instance" "web" { ami = "ami-123" instance_type = "t3.micro" }. Arguments: key-value pairs within blocks. Expressions: reference values: var.region, aws_vpc.main.id. Comments: # or // for single-line, /* */ for multi-line. String interpolation: "${var.prefix}-server". HCL supports conditionals (condition ? true_val : false_val), for expressions, count and for_each meta-arguments for resource iteration. Files use the .tf extension.