Salta ai contenuti

Smantellamento

Al termine della sessione di laboratorio, distruggi tutte le risorse Azure per interrompere la fatturazione.

Dalla directory contenente la configurazione Terraform:

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

Terraform richiederà una conferma. Digita yes per procedere.

Conferma che tutte le risorse siano state rimosse:

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"

Rimuovi lo stato di Terraform e i file memorizzati nella cache:

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

Se hai modificato il DNS o i file hosts durante l’integrazione, ripristina tali modifiche:

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

Se hai creato un record DNS di tipo A, eliminalo tramite il tuo provider DNS.