Trying to time things correctly for pre-cleanup
This commit is contained in:
parent
353a88cbd4
commit
80b048c07b
1 changed files with 14 additions and 6 deletions
|
|
@ -62,19 +62,27 @@ resource "null_resource" "talos_cluster" {
|
|||
|
||||
provisioner "local-exec" {
|
||||
command = <<EOT
|
||||
# Clean up any existing cluster with this name FIRST
|
||||
set -e # Exit on error
|
||||
|
||||
# First, try to destroy the cluster properly
|
||||
echo "Attempting to destroy existing cluster..."
|
||||
sudo --preserve-env=HOME talosctl cluster destroy \
|
||||
--provisioner=qemu \
|
||||
--name ${self.triggers.cluster_name} || true
|
||||
--name ${self.triggers.cluster_name} 2>/dev/null || echo "Cluster destroy completed or not found"
|
||||
|
||||
# Wait a moment for cleanup to complete
|
||||
sleep 5
|
||||
# Wait for cleanup
|
||||
sleep 3
|
||||
|
||||
# Call cleanup script
|
||||
# Now run the comprehensive cleanup script to remove any leftovers
|
||||
echo "Running comprehensive cleanup..."
|
||||
chmod +x ${path.module}/cleanup.sh
|
||||
${path.module}/cleanup.sh ${self.triggers.cluster_name}
|
||||
|
||||
# Wait a bit more to ensure everything is cleaned up
|
||||
sleep 2
|
||||
|
||||
# Now create the cluster
|
||||
echo "Creating new cluster..."
|
||||
sudo --preserve-env=HOME talosctl cluster create \
|
||||
--provisioner=qemu \
|
||||
--name ${self.triggers.cluster_name} \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue