Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Azure icon
Labs

Create a VM Cluster in Azure with Terraform

In this lab, you are asked to start building out an app server cluster for a comic reader that you are working on for your employer for digital comics. To do this, you will configure Cloud Shell and run the lab setup script; import the resource group; deploy the Azure Storage account configuration; and add the VM cluster configuration and deploy your cluster.

Azure icon
Lab platform
Lab Info
Level
Advanced
Last updated
Sep 25, 2025
Duration
45m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Set Up Cloud Shell and the Lab Environment

    In the Portal

    1. Click the Cloud Shell icon (>_) in the upper right.

    2. Select Bash.

    3. In the Getting started pane, select No storage account required for an ephemeral session.

    4. Using the dropdown menu, select the only subscription available.

    5. Click Apply.

    6. In Cloud Shell, create the clouddrive directory:

      mkdir clouddrive
      
    7. Change directory:

      cd clouddrive
      
    8. Download the lab_5_setup.sh script: https://raw.githubusercontent.com/ACloudGuru/advanced-terraform-with-azure/main/lab_vm_cluster_resources/lab_5_setup.sh

    9. Add execute permissions to the script.

    10. Run the lab_5_setup.sh script.

  2. Challenge

    Import the Resource Group

    In the Cloud Shell

    1. In the Cloud Shell, review the networking.tf file.

    2. Make note of the resource group and label, and then close the file.

    3. Run the az group list command to get the subscription ID.

    4. Import your resource group into Terraform using the resource name, label, and subscription ID.

    5. After the import, add the name and location of your resource group to the networking.tf file so it looks like the code below (fill in with your resource group and location):

      resource "azurerm_resource_group" "comics" {
          name     = "<RESOURCE_GROUP>"
          location = "<LOCATION>"
      }
      
    6. Save the file.

  3. Challenge

    Define Your Cluster Config and Output Variables

    In the Cloud Shell

    1. Create a file called vms.tf.
    2. Define the VM configuration so it will deploy a two-VM cluster using count.
    3. Make sure you associate your VMs with your subnet and load balancer backend pool in the networking.tf file, and adjust for the multiple resources in your configuration.
    4. Save the changes.
    5. Create a file called output.tf.
    6. Define the these outputs:
      • Resource group
      • Private IP of the first VM
      • Private IP of the second VM
      • Public IP
      • Resource group location
    7. Save the changes.
  4. Challenge

    Add the VM Cluster Terraform Config and Deploy

    In the Cloud Shell

    1. Apply your configuration.
    2. Confirm you have successfully deployed your VM cluster.
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

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.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight