/learn-terraform-azure

Getting started with Terraform on Azure

Primary LanguageHCLMIT LicenseMIT

learn-terraform-azure

Getting started with Terraform on Azure

Prerequisites

Steps

  1. Login to Azure CLI
az login
  1. Create a Service Principal for Terraform
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/<subscription_id>"
  1. Create a terraform.tfvars file and add the following variables
subscription_id = "<subscription_id>"
client_id = "<client_id>"
client_secret = "<client_secret>"
tenant_id = "<tenant_id>"
  1. Initialize Terraform
terraform init
  1. Create a Terraform plan
terraform plan -out plan
  1. Apply the Terraform plan
terraform apply plan
  1. Destroy the Terraform plan
terraform destroy