Bicep Essentials
| File Extension | .bicep — transpiles to ARM JSON |
| Resource | resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' |
| Parameters | param location string = resourceGroup().location |
| Variables | var storageName = 'st${uniqueString(resourceGroup().id)}' |
| Modules | module vnet './modules/vnet.bicep' = { ... } |
| Deploy | az deployment group create --template-file main.bicep |
Terraform Essentials
| File Extension | .tf — HCL syntax |
| Resource | resource "azurerm_resource_group" "rg" { ... } |
| Variables | variable "location" { default = "uksouth" } |
| Outputs | output "rg_id" { value = azurerm_resource_group.rg.id } |
| State | Remote state in Azure Storage Account or Terraform Cloud |
| Commands | terraform init → plan → apply → destroy |
Bicep vs Terraform Comparison
| Provider | Bicep: Azure-only | Terraform: Multi-cloud |
| State | Bicep: Managed by Azure | Terraform: Explicit state file |
| Language | Bicep: Bicep DSL | Terraform: HCL |
| Modules | Bicep: Registry/local | Terraform: Registry/local/Git |
| CI/CD | Both integrate with Azure DevOps and GitHub Actions |
| Learning Curve | Bicep: Lower for Azure-only | Terraform: Broader ecosystem |