- Lab
- A Cloud Guru
Using Terraform with Azure (Setting the Stage)
Welcome to the Using Terraform with Azure lab. In this lab, we will cover three objectives: 1. Log into Azure 1. Create the Terraform Configuration 1. Deploy the Configuration By the end of the lab, you'll have deployed a container group to Microsoft Azure using Terraform.
Path Info
Table of Contents
-
Challenge
Log into Azure
In this objective, you'll use the credentials provided by the lab to log into Azure using the Azure CLI.
- Open your terminal and run the
az login
command - In the browser window that opens, enter the credentials provided by the lab
- Run
az account show
to verify you've logged in successfully
- Open your terminal and run the
-
Challenge
Create the Terraform Configuration
In this objective, you'll create a Terraform configuration that deploys a container group to Azure.
- Create new directory and files to hold your Terraform configuration.
- Add a
terraform
block requiring major version 3 of theazurerm
provider. - Add an
azurerm
provider block with theskip_provider_registration
argument set totrue
. - Add a data source to reference the existing resource group.
- Add a container group resource that uses the ACI hello world image and exposes port 80 on a public URL.
- Image reference:
mcr.microsoft.com/azuredocs/aci-helloworld
- Image reference:
- Add an output to display the FQDN of the container group.
- Initialize your working directory.
- Format and validate the code.
-
Challenge
Deploy the Configuration
In this objective, you'll deploy the Terraform configuration to Azure and verify the deployment.
- Create a
terraform.tfvars
file and populate any required variables. - Deploy the configuration to Azure.
- Visit the address shown in the output and verify the webpage loads.
- Create a
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.