Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Azure icon
Labs

Using Terraform with Azure

Hey, Gurus! Welcome to the Using Terraform with Azure hands-on lab. In this lab, we will cover 3 objectives. First, we will log into the Azure portal and configure the Cloud Shell to use Bash. Second, we check which version of Terraform the Cloud Shell is running. If it is not the latest version, we will update it. In our final objective, we configure Terraform to use the Terraform Azure provider. Instead of jumping around to different screens, this is a quick and easy way to use Terraform with Azure.

Azure icon
Labs

Path Info

Level
Clock icon Advanced
Duration
Clock icon 15m
Published
Clock icon Jun 17, 2022

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Setup Cloud Shell

    In the portal

    1. Go to the portal and log in using your lab credentials.
    2. Click the Cloud Shell icon next to the search bar in the portal.
    3. Select Bash at the prompt.
    4. Click Show Advanced Settings.
    5. Set the Cloud Shell region to the same location as the resource group.
    6. Select the existing Resource Group, and select Use Existing for the Storage Account.
    7. In the File share section, choose Create new and enter "terraform".
    8. Click Attach Storage.
  2. Challenge

    Check the Terraform Version

    In the Cloud Shell

    1. Check the Terraform version in the Cloud Shell.
    2. If the Terraform version is up to date, proceed to the next objective. If it is out of date, follow the steps below.
    3. Download the updated Terraform binary from the lab repo to the Cloud Shell.
    4. Unzip the terraform_1.1.7_linux_amd64.zip file.
    5. Create a directory called bin.
    6. Move the terraform binary to the bin directory.
    7. Check the Terraform version to confirm you are using the newest version available.
  3. Challenge

    Configure Terraform Azure Provider

    In the Cloud Shell

    1. Create a working directory called terraformguru.
    2. Move into the terraformguru working directory.
    3. Create a file called providers.tf.
    4. Paste the following code into the providers.tf file:
      terraform {
        required_providers {
          azurerm = {
            source  = "hashicorp/azurerm"
            version = "=2.91.0"
          }
        }
      }
      
      provider "azurerm" {
        features {}
        skip_provider_registration = true
      }
      
    5. Save the file.
    6. Initialize your working directory.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans