From the course: Introduction to Terraform on Azure

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Understanding Terraform's HCL syntax

Understanding Terraform's HCL syntax

From the course: Introduction to Terraform on Azure

Understanding Terraform's HCL syntax

- [Instructor] HCL, which is HashiCorp Configuration Language, is designed to be both human-readable and machine-possible, making it perfect for defining infrastructure as code. There are several key components that work together to define your infrastructure. First is the blocks. Blocks are the fundamental building units in HCL. They have a type, zero or more labels, and contain a body with argument and nested blocks. For example, the first word in these sample definitions is the block type, like resource, data, terraform, and provider. Then we have the resource blocks, which would always have exactly two labels, the resource type and a local name you choose. Data blocks also have two labels, the data source type and a local name. Terraform blocks have no labels, and lastly, provider blocks have one label being the provider name. You would notice that the data block is a data source that automatically retrieves information about your current Azure authentication context. It doesn't…

Contents