- Clear structure: Each block type has an explicit responsibility, which improves readability and simplifies reviews.
- Flexibility and modularity: Use only the block types required for a given task — combine them as needed to model your infrastructure.
- Reusable patterns: Well-defined blocks make modules and shared patterns easier to maintain and scale across teams.
- provider: Connects Terraform to a target platform (AWS, Azure, GCP, etc.). Acts as the adapter to the platform’s API.
- resource: Declares the resources Terraform will create and manage (VMs, networks, storage).
- data: Reads information about existing resources or remote data sources without creating them.
- variable: Parameterizes values so configurations are reusable across environments.
- output: Exposes values from a run for use by users, CI/CD systems, or other modules.
- terraform: Configures Terraform-specific settings, e.g., backends and required providers.
- module: Groups related resources into reusable units by referencing other directories or remote modules.
- import (conceptual): Not an HCL block —
terraform importCLI brings existing resources into state management.
Practical examples
provider block
- Order is flexible: HCL does not require a strict order for blocks, but grouping related blocks improves readability.
- Keep modules focused: Design modules to do one thing well (networking, compute, storage) and expose a small set of variables and outputs.
- Use
terraform fmtandterraform validateas part of CI to enforce style and catch errors early.

Note that while the infographic includes “import” for conceptual completeness, Terraform does not provide an HCL “import” block. To bring existing resources into Terraform’s state, use the
terraform import CLI command.- Terraform documentation — https://www.terraform.io/docs
- HCL language documentation — https://github.com/hashicorp/hcl
- Terraform CLI: terraform import — https://www.terraform.io/cli/import