Skip to content

Teardown

When the lab session is complete, destroy all Azure resources to stop billing.

From the directory containing the Terraform configuration:

Terminal window
# Review what will be destroyed
terraform plan -destroy
# Destroy all resources
terraform destroy

Terraform will prompt for confirmation. Type yes to proceed.

Confirm all resources have been removed:

Terminal window
# Check resource group is gone
az group show --name "$(terraform output -raw resource_group_name)" 2>&1 \
| grep -q "ResourceGroupNotFound" \
&& echo "Resource group deleted" \
|| echo "Resource group still exists"

Remove Terraform state and cached files:

Terminal window
rm -rf .terraform .terraform.lock.hcl terraform.tfstate terraform.tfstate.backup

If you modified DNS or hosts files during integration, revert those changes:

Terminal window
# Remove hosts file entry (Linux/macOS)
sudo sed -i '/<CDN_EDGE_PUBLIC_IP>/d' /etc/hosts

If you created a DNS A record, delete it through your DNS provider.