← Lessons/HCL Basics

HCL Basics

Terraform configuration is written in HCL (HashiCorp Configuration Language). A configuration is just one or more .tf files made of blocks.

A block has a type, zero or more labels, and a body of key = value arguments:

block_type "label_one" "label_two" {
  argument = "value"
}

1 mini lesson

0 of 1 done
  1. Validate the configuration
Start →
hclprovidersterraform-validate

Interview prep

The basics interviewers expect you to state crisply.

What does terraform validate check — and what does it NOT?

validate confirms the configuration is syntactically valid and internally consistent (references resolve, argument types line up), entirely offline. It does NOT contact a provider, read state, or tell you what will change — that's plan.

What is a Terraform provider?

A plugin that maps Terraform resources onto a platform's API — hashicorp/aws knows how to create/read/update/delete AWS resources. The required_providers block declares which providers (and version constraints) a configuration needs.