Manage Resource Drift and Terraform State Operations
Detect resource drift, reconcile infrastructure changes, and perform Terraform state operations on Azure resources.

Lab overview
Terraform maintains a state file that represents the intended configuration of your cloud resources. Over time, manual changes through the portal or CLI cause the actual infrastructure to diverge from the declared state - a condition known as resource drift. Detecting and reconciling drift is a critical operational skill because unaddressed drift leads to unpredictable deployments, configuration conflicts, and potential outages.
In this lab, you will deploy Azure resources using Terraform, introduce drift by making out-of-band changes, detect and reconcile the drift using plan and apply, manipulate state entries with terraform state commands, and refactor resource addresses using moved blocks.
Objectives
Upon completing this intermediate level lab, you will be able to:
- Deploy Azure storage accounts and virtual networks using Terraform
- Detect resource drift by comparing planned state against actual infrastructure
- Reconcile drift using terraform apply to restore declared configuration
- Use terraform state mv, rm, and import to manipulate state entries
- Refactor Terraform configurations with moved blocks to rename resources safely
Who is this lab for?
This lab is designed for:
- Cloud engineers who manage Terraform-provisioned infrastructure and need to handle drift
- DevOps engineers looking to strengthen their Terraform state management skills
- Platform engineers responsible for maintaining infrastructure consistency across environments
Verified against your live environment
An automated validation engine inspects your actual resources and configurations as you work. Completion means the task was performed, not multiple choice, real-world proficiency.
More labs like this
Import Existing Infrastructure into Terraform State Management
Use Terraform import blocks and the legacy import command to bring pre-existing Azure resources under Terraform state management.
Managing Azure Blob Storage Operations with Azure CLI
Learn how to perform essential Azure Blob Storage operations using Azure CLI commands. Practice uploading, downloading, listing, and deleting blobs with batch operations.
Terraform Resource Dependencies and Lifecycle Rules on Azure
Build implicit dependencies through resource references, add explicit depends_on blocks, and configure lifecycle rules for Azure resources with Terraform.
Environment
Every lab includes
- Real environment, pre-credentialed
- Automated checks on every step
- Isolated sandbox, auto cleanup
- AI-recommended next steps
Lab curriculum
- 01
Logging into Azure CLI
- 02
Deploying Azure Resources Using a Terraform Configuration
1 automated check
- 03
Detecting and Reconciling Resource Drift with Terraform
1 automated check
- 04
Manipulating Terraform State Entries and Imports
1 automated check
- 05
Refactoring Resource Addresses Using Terraform Moved Blocks
1 automated check
Skills validated
Not the lab you were looking for?
Browse 200+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.