Terraform
What it is
Terraform (HashiCorp) is an open-source cross-cloud infrastructure as code tool. You write infrastructure in HCL (HashiCorp Configuration Language), and Terraform’s providers translate that into API calls for many clouds — including the AzureRM and AzureAD providers for Azure. Terraform keeps a state file that records what it has created, and compares desired vs. current state before each apply.
Why it exists
Organizations are multi-cloud / hybrid. An Azure-only DSL like Bicep or ARM templates can’t manage AWS, GCP, or on-prem in one language. Terraform gives a single declarative workflow and model across every provider, plus a huge public module registry and mature plan/apply lifecycle.
Key ideas
- HCL syntax:
.tffiles declare resources, data sources, variables, outputs, and modules. - Plan / Apply loop:
terraform planshows the diff (+ change / ~ update / - destroy);terraform applyexecutes it — the equivalent of desired-state reconciliation. - State file (
terraform.tfstate): the source of truth for mapping resources to real objects; must be stored remotely (e.g. Azure Storage with locking) for team use. - Providers: plugin resolvers (AzureRM, AWS, GCP, kubernetes);
azurermmanages Azure resources,azurerm_backendfor state. - Integration with Pipelines/GitHub Actions: Terraform tasks in Azure Pipelines or GitHub Actions run init → plan → apply as a provisioning-pipeline.
How it fits (diagram)

Diagrams courtesy of Microsoft Learn / Azure docs: azure/developer/terraform/overview
Exam notes
- Compare to Bicep: Bicep = Azure-only, transpiles to ARM, no state file (ARM refreshes from live). Terraform = multi-cloud, HCL, explicit state, third-party.
- Know
terraform init(download providers),plan,apply,destroy, and remote state locking. - Terraform drift detection:
terraform planagainst live cloud reveals manual changes → configuration drift.
Related
infrastructure-as-code · bicep · arm-template · desired-state · configuration-drift · provisioning-pipeline
📘 Source: Microsoft Learn — Terraform