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

Use Output Variables to Query Data in Azure Using Terraform

In this lab, we will demonstrate the usefulness of adding output variables to your configuration and how they can be used to collect data about resources in your infrastructure. In this lab, we will first deploy the virtual network to test deploying to the new Azure test environment, along with a subnet. You will then add some output variables to a file to output the virtual network name and the subnet name, expanding on your configuration and adding some outputs that you can use later to easily access these values. Once you have finished testing, you will then destroy your test infrastructure.

Azure icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 23, 2025
Duration
15m

Contact sales

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

    Deploy the Infrastructure
    1. In the CLI, download the source files from the lab GitHub repo: https://github.com/pluralsight-cloud/Use-Output-Variables-to-Query-Data-in-Azure-Using-Terraform
    2. Change to the Use-Output-Variables-to-Query-Data-in-Azure-Using-Terraform working directory.
    3. Review the Terraform configuration file.
    4. Add the labs Azure Resource Group name and Subscription ID to the configuration.
    5. Initialize the working directory.
    6. Apply the Terraform configuration.
  2. Challenge

    Add the Outputs Variable File
    1. Create an outputs file named outputs.tf.
    2. Add the following code to the outputs.tf file:
     output "azurerm_virtual_network_name" {
      value = azurerm_virtual_network.vnet.name
    }
    
    output "azurerm_subnet_name" {
      value = azurerm_subnet.subnet.name
    }
    
    1. Apply your changes to the infrastructure.
    2. Inspect the ouput of your apply command.
    3. Confirm your outputs can be displayed whenever needed.
  3. Challenge

    Destroy the Test Infrastructure
    1. Destroy your infrastructure after successful deployment.
    2. Confirm destruction.
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