#!/bin/bash

# Check if all arguments are provided
if [ "$#" -ne 3 ]; then
    echo "Usage: $0 <number_of_iterations> <cluster_name> <initial_password>"
    exit 1
fi

# Assign arguments to variables
iterations=$1
cluster_name=$2
initial_password=$3

# Loop and call the python script
for ((i=1; i<=iterations; i++))
do
    project_name=$(printf "%s%02d" "$TIDB_PROJECT_PREFIX" "$i")
    echo "creating ${project_name} cluster ..."
    python src/create_cluster.py $cluster_name $project_name $TIDB_DEFAULT_REGION $initial_password

    if ((i % 3 == 0)); then
        read -p "Press enter to continue..."
    fi
done