Skip to content

Azure Terraform VSCode Extension

Pre-requisite: Configure Azure Cloud Shell

  • Configure Azure Cloud Shell.

Step-01: Introduction

  • For students, who have difficulty in running in local desktops (windows or mac), they can use this plugin to run on Azure Cloud Shell.
  • Learn about Azure Terraform VSCode Extension

Step-02: Install graphviz

# Install Graphviz
brew install graphviz

Step-03: Install NodeJS

Step-04: Install the Azure Terraform Visual Studio Code extension

  • Azure Terraform VSCode Extension
  • The features in this extension support execution in integrated terminal mode or remotely using Azure Cloud Shell.
  • Some features only run locally at this time and will require some local dependencies.
  • Azure Terraform: init
  • Azure Terraform: plan
  • Azure Terraform: apply
  • Azure Terraform: validate
  • Azure Terraform: refresh
  • Azure Terraform: destroy
  • Azure Terraform: visualize
  • Azure Terraform: push
  • Azure Terraform: Execute Test

Step-05: VS Code - Integrated Terminal: Run Commands Terraform init, plan, apply, visualize

  • Update VS Code Settings -> Extensions -> Azure Terraform -> Azure Terraform: Terminal -> Integrated
  • Open 06-Azure-Terraform-VsCode-Plugin/terraform-manifests in a new vscode window.
  • Test the following commands (CMD + SHIFT + P)
  • Azure Terraform: init
  • Azure Terraform: validate
  • Azure Terraform: plan
  • Azure Terraform: apply
  • Azure Terraform: destroy
  • Azure Terraform: visualize
  • Review the Terraform Graph

Step-06: VS Code - CloudShell Terminal: Run Commands Terraform init, plan, apply, visualize

  • Create CloudShell storage if not created or not accessed Cloudshell for the first time.
  • Update VS Code Settings -> Extensions -> Azure Terraform -> Azure Terraform: Terminal -> CloudShell
  • Open 06-Azure-Terraform-VsCode-Plugin/terraform-manifests in a new vscode window.
  • Test the following commands
  • Azure Terraform: Push
  • Azure Terraform: init
  • Azure Terraform: validate
  • Azure Terraform: plan
  • Azure Terraform: apply
  • Azure Terraform: destroy
  • Make change to c1-versions.tf and run Azure Terraform: Push command and Verify in Azure cloudshell
  • Azure Terraform: Push
  • Azure Terraform: plan

Step-06: Clean-up

# Clean-Up files (if any exists of below type)
rm -rf .terraform*
rm -rf terraform.tfstate

References