2024-07-30 17:02:53 +03:00

21 lines
514 B
Bash
Executable File

#!/bin/bash
YC_TOKEN=$(yc iam create-token)
export YC_TOKEN
# Run Terraform destroy and check the exit code
if ! terraform destroy -auto-approve; then
echo "Terraform destroy failed. Script execution stopped."
exit 1
fi
# Ansible inventory file
inventory_file="inventory.ini"
# Check if the inventory file exists and remove it
if [ -f "$inventory_file" ]; then
rm "$inventory_file"
echo "Inventory file $inventory_file removed."
else
echo "Inventory file $inventory_file does not exist."
fi