Skip to content

Introduction

As you discovered in the Level 100 section - HashiCorp created the HCL language to provide a user-friendly, expressive syntax that enables you to define infrastructure resources, variables, inputs, data, and functions in a clear and intuitive manner.

This module of the workshop will focus on the key features of HCL; these are the core to building up a Terraform project. In each section of the workshop, you will gain practical insights and experience in utilizing HCL to build sophisticated and dynamic infrastructure configurations.

  • Resource blocks let you define and provision cloud infrastructure — compute instances, storage, networks, and more — all managed through Terraform.
  • Variables make your Terraform configurations reusable and easier to customize across environments.
  • You can use different variable types and input mechanisms to parameterize your infrastructure definitions.
  • Validation rules let you enforce constraints on variable values and catch errors early.
  • Optional object attributes allow you to define flexible variable types with sensible defaults.
  • When you need information from external systems, data sources pull it into your configuration. Locals handle computations, transformations, and data manipulations within your Terraform code.
  • Use HCL functions to manipulate data, perform calculations, iterate over collections, and make decisions based on conditions.
  • Provider-defined functions extend HCL with provider-specific logic you can call directly in your configurations.