Create a Private Module Registry in Terraform Cloud for Azure

45 minutes
  • 4 Learning Objectives

About this Hands-on Lab

In this hands-on lab, you’ll create a Terraform module, publish the module to a private registry in Terraform Cloud, and create a configuration that leverages the module to deploy a secure storage account.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a GitHub Repository for Your Module
  1. Create a GitHub repository for your Terraform Module with the following properties:

    • Use a name with the format terraform-azurerm-<module name>.
    • Ensure the repository is public.
    • Add a Terraform git ignore.
    • Include a readme file.
Author Your Terraform Module
  1. Clone your repository to the Infrastructure as Code workstation.
  2. Author a module that includes a, and file.
  3. Include input variables for the Resource Group Name, Location, Storage Account Name, and Environment.
  4. Include a local variable for resource tags, set the Environment tag to the environment variable Environment.
  5. Create a secure storage account resource that includes the a hardcoded values for the following:
    • Set Public Network Access to be blocked
    • Ensure the account tier is set to Standard
  6. Include variables in the secure storage account resource and set the tags using the local variable.
  7. Include an output variables for the Storage Account ID.
  8. Create a release in GitHub for your module.
Publish Your Module to Your Private Registry

Import the module into your Terraform Cloud private registry.

Author and Apply a Configuration Using the Module
  1. Author a Terraform configuration that uses the module to deploy a storage account.
  2. Use the below provider configuration to avoid permissions issues when deploying your resources:

    provider "azurerm" {
        features {}
        skip_provider_registration = true

Additional Resources


As you walk through the lab, consider the following scenario:

You're playing the role of a platform engineer with River City AI.

River City AI specializes in optimizing speech to text for efficiency and accuracy using machine learning. They’re working on next-generation speech recognition for generative AI.

River City AI is already using Amazon Web Services. Due to the success and capabilities of Microsoft’s Data and AI services, they are looking to adopt a multi-cloud environment to drive innovation. Because they are multi-cloud, Terraform is an excellent choice to deploy their infrastructure as code.

You’ll be working with an existing virtual machine that has been configured as an Infrastructure as code Workstation, with all the required software, including Terraform, the Azure CLI, and Visual Studio code with the Terraform extension for VS code installed.

You’ve been tasked with creating a secure storage account Terraform module that can be used by you and other platform engineers to reliably and consistently deploy secure storage accounts that will be used to store data used to train AI models.

In this lab, you will:

  1. Create a GitHub repository for your Terraform module code.
  2. Author your Terraform module.
  3. Publish your module to a private registry in Terraform Cloud.
  4. Author and apply a configuration that uses the module to deploy a secure storage account.

Lab Setup

In this lab, you will be connecting to the VM using Remote Desktop and you will have access to the Azure portal.

Note: To complete this lab, you will need to use a remote desktop client.

Note: To complete this lab, you will need:

  • Your own free Terraform Cloud account, you can sign up at Terraform Cloud.
  • Your own free GitHub account, you can sign up to join GitHub.

If you get stuck, feel free to check out the lab objectives or the solution video. Good luck!

WARNING: Be Prepared for UI Changes Given the fluid nature of Microsoft's cloud tools, you may experience user interface (UI) changes that were made following the development of this hands-on lab that do not match up with the lab instructions. When any such changes are brought to our attention, we will attempt to update the content accordingly. However, if changes occur, you will have to adapt to the changes and work through them in the hands-on labs as needed.

What are Hands-on Labs

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.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?