Challenge - Import and Refactor Existing Infrastructure with Terraform
Bring pre-existing Azure resources under Terraform management without recreating them, reconcile your configuration to a zero-change plan, then refactor the storage account into a reusable module.

Lab overview
Terraform can adopt resources that were created outside it, then keep those resources running while you reshape the configuration. Import brings live Azure infrastructure into state. A moved block later relocates a resource address, for example into a module, without destroying the real resource.
You will import a pre-existing storage account, virtual network, and subnet, write configuration that produces a zero-change plan, then extract the storage account into a local module.
By completing this Intermediate challenge, you will be able to:
- Import existing Azure resources into Terraform state without recreating them
- Write configuration that matches live infrastructure so a plan reports no changes
- Move a resource into a local module without changing the deployed storage account
Prerequisites
- Terraform HCL, state, and CLI (
init,plan,apply,state) - Azure CLI resource inspection
Recommended Lab: Introduction to Azure Terraform
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
Deploy a Full Azure Environment Using Bicep Infrastructure as Code
Write modular Bicep templates to deploy a VNet, App Service, SQL Database, and Key Vault, then deploy the full environment using Azure CLI.
Introduction to Infrastructure as Code with Terraform on AWS
Write your first HCL configuration and deploy a DynamoDB table to AWS using Terraform's init, plan, and apply workflow.
Challenge - Validate and Secure a Terraform Configuration
Add variable validation, sensitive markers, postconditions, and check blocks to secure a Terraform configuration on Azure.
Related reading
Environment
Every lab includes
- Real environment, pre-credentialed
- Automated checks on every step
- Isolated sandbox, auto cleanup
- AI-recommended next steps
Lab curriculum
- 01
Import and Refactor Azure Resources with Terraform
5 automated checks
Skills validated
Not the lab you were looking for?
Browse 150+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.