Skip to content

Teardown

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

From the terraform/ directory:

Terminal window
cd terraform/
terraform plan -destroy
terraform destroy

Terraform will prompt for confirmation. Type yes to proceed.

Confirm all resources have been removed:

Terminal window
RG_NAME=$(terraform output -raw resource_group_name)
az group show --name "${RG_NAME}" 2>&1 | grep -q "ResourceGroupNotFound" \
&& echo "Resource group deleted" \
|| echo "Resource group still exists"
az resource list --resource-group "${RG_NAME}" -o table 2>/dev/null

Remove Terraform state and cached files:

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

If you want to keep the traffic suite results before destroying the VM, copy them locally:

Terminal window
TGEN_IP=$(terraform output -raw public_ip)
# Copy all results to local machine
scp -r azureuser@${TGEN_IP}:/opt/traffic-generator/results/ ./traffic-results/
# Or copy just the latest run
LATEST=$(ssh azureuser@${TGEN_IP} 'ls -t /opt/traffic-generator/results/ | head -1')
scp -r azureuser@${TGEN_IP}:/opt/traffic-generator/results/${LATEST} ./traffic-results/

If you also want to remove the F5 XC configuration that the traffic generator was targeting:

  1. Delete the HTTP load balancer
  2. Delete the origin pool
  3. Delete any WAF policies, Bot Defense configurations, API Security policies, or CSD configurations created for testing

These F5 XC resources do not incur Azure costs but should be cleaned up when the demo environment is no longer needed.