You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Terraform is a multi-cloud IaC tool that provides first-class support for Azure through the AzureRM provider. Many organisations choose Terraform for Azure because it supports multi-cloud deployments, has a mature ecosystem, and provides explicit state management. This lesson covers how to configure, authenticate, and deploy Azure resources with Terraform.
# Install Azure CLI
brew install azure-cli # macOS
# or: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash # Linux
# Install Terraform
brew install terraform # macOS
# or: sudo apt-get install terraform # Linux (via HashiCorp repo)
# Verify
az version
terraform version
az login
az account set --subscription "My Subscription"
Terraform uses the Azure CLI credentials by default.
terraform {
required_version = ">= 1.5"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.100"
}
}
backend "azurerm" {
resource_group_name = "rg-terraform-state"
storage_account_name = "stterraformstate"
container_name = "tfstate"
key = "webapp.terraform.tfstate"
}
}
provider "azurerm" {
features {}
subscription_id = var.subscription_id
}
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.