Skip to the content.

@matwolbec tutorials

Terraform on Azure Esssentials

Requirements and infos for essential terraform on azure usage

About Terraform

Terraform is an open-source infrastructure as code software tool that enables you to safely and predictably create, change, and improve infrastructure.

For further info, check https://www.terraform.io/

Pages

Install requirements

Basic terraform commands

terraform init #  Prepare your working directory for other commands
terraform plan # Show changes required by the current configuration
terraform apply # Create or update infrastructure
terraform destroy # Destroy previously-created infrastructure
terraform import # Associate existing infrastructure with a Terraform resource

Setting directories and initial file

You must define your workdir. Usually the workdir will be the name of your Infra Project.

In this case I will create a directory for this tutorial:

mkdir howto-terraform
cd howto-terraform

Now you can create another dir to define different environments, like staging and production:

mkdir staging production tfstatus-storage

Create a main.tf file. We will use the staging directory first

cd staging
touch main.tf

Logging into the Azure CLI

Before we can start to use Terraform, we have to login on Azure CLI:

az login

Get the subscription list (we don’t need it right now, but you can have more subscriptions)

az account list

Next steps

Go to page 2 to start using terraform