Friday 21 August 2020

Getting Started with Terraform for Azure in Windows 10

Terraform is a great way to setup infrastructure as code (IaC) for Azure. Terraform helps us to codify and version control our infrastructure needs in multiple platforms, hence, making learning terraform for IaC for Azure would let an individual to easily get adapted to other platforms such as AWS. IN this post let’s have a quick look at preparing a Windows 10 machine to get started with terraform.

As the first requirement you may install the latest stable version of PowerShell, using the installer msi downloaded from here https://github.com/PowerShell/PowerShell. However, if you already have PowerShell version 5.1 or higher it should be sufficient. If you update to latest version of PowerShell 7 you will have a separate Windows PowerShell 7 app.

To check your version of PowerShell version you can run $PSVersionTable command.



Install PowerShell Az module.

Install-Module -Name Az -AllowClobber -Scope CurrentUser

Then run

Import-Module Az

To get the Az Module imported. Now if you execute a Get-Module you will see the Az module available to use in latest version of PS.



Install the latest version of Azure CLI following instructions here https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest&tabs=azure-cli.

To check installed version of Azure CLI run az --version



Then download Terraform for Windows from https://www.terraform.io/downloads.html and extract to a desired path say c:\Terraform. Setup Path env variable to have new entry for Terraform path.



Execute Terraform from a new PowerShell window.



Now, we are all set with our Windows 10 machine to use Terraform development for infra as code, and in a next post let’s check how we can get some simple Azure platform services created using Terraform

No comments:

Popular Posts