Terraform Resources and Data Sources on Azure

Beginner
AutoVerification
IsolatedSandbox
45 mDuration

Create Azure resources with Terraform, query existing infrastructure using data sources, and combine both patterns in a single configuration.

Skills Validated

Terraform

Lab Overview & Objectives

Terraform manages cloud infrastructure through two complementary mechanisms - resources and data sources. A resource block declares infrastructure that Terraform creates, updates, and destroys as part of its lifecycle, while a data source queries existing infrastructure that was provisioned outside of the current configuration. Combining both patterns in a single project lets you deploy new components that reference pre-existing resources, such as attaching a network security group to a subnet that was created by a different team or an ARM template deployment.

In this lab, you will create Azure resources using Terraform resource blocks, query a pre-provisioned virtual network and subnet using data sources, and then combine both patterns by deploying a network security group that references the existing subnet through a data source. The lab environment provides a resource group with a VNet and subnet already provisioned, so you can focus on the Terraform workflow of creating new resources alongside existing ones.

Objectives

Upon completion of this beginner level lab, you will be able to:

  • Configure the AzureRM Terraform provider and initialize a project
  • Create Azure resources such as storage accounts using Terraform resource blocks
  • Query existing Azure infrastructure using data source blocks for virtual networks and subnets
  • Reference data source attributes in resource definitions to link new and existing infrastructure
  • Deploy a network security group associated with a pre-existing subnet using terraform apply

Who is this lab for?

This lab is designed for:

  • Cloud engineers learning how Terraform differentiates between managed and read-only infrastructure
  • DevOps practitioners who need to integrate Terraform with environments that contain pre-existing resources
  • Terraform Associate candidates preparing for exam objectives covering resources and data sources

Real-Time Validation

Our platform uses an automated validation engine to verify your configurations as you work through the lab modules. No multiple choice—just real-world proficiency.

[SYSTEM] VALIDATION_ACTIVEv2.4.0
Checking resource: vpc-ingress-01...
Scanning security policy: allow-ssh...
Modules
4
Duration
45 m

Lab Curriculum

01

Logging into Azure CLI

02

Create Azure Resources with Terraform Blocks

03

Query Existing Infrastructure with Data Sources

04

Combine Resources and Data Sources Together