Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions modules/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ module "initial" {
data.aws_availability_zones.available,
]
source = "rancher/rke2/aws"
version = "1.2.1"
version = "1.2.2"
for_each = local.initial_node
project_use_strategy = "create"
project_vpc_use_strategy = "create"
Expand Down Expand Up @@ -341,11 +341,16 @@ resource "terraform_data" "create" {
ATTEMPTS=0
MAX=3
while [ $EXITCODE -gt 0 ] && [ $ATTEMPTS -lt $MAX ]; do
echo "Starting attempt $ATTEMPTS..."
timeout 3600 terraform apply -var-file="inputs.tfvars" -auto-approve -state="${self.triggers_replace.path}/tfstate"
echo "Starting attempt $((ATTEMPTS + 1))..."
timeout 1h terraform apply -var-file="inputs.tfvars" -auto-approve -state="${self.triggers_replace.path}/tfstate"
EXITCODE=$?
if [ $EXITCODE -eq 124 ]; then echo "Apply timed out after 1 hour"; fi
ATTEMPTS=$((ATTEMPTS + 1))
echo "Exit code $EXITCODE..."
if [ $EXITCODE -gt 0 ] && [ $ATTEMPTS -lt $MAX ]; then
echo "wait 30 seconds between attempts..."
sleep 30
fi
done
exit $EXITCODE
EOT
Expand All @@ -354,17 +359,23 @@ resource "terraform_data" "create" {
# warning! this is only triggered on destroy, not refresh/taint
when = destroy
command = <<-EOT
set -x
cd ${self.triggers_replace.path}
TF_DATA_DIR="${self.triggers_replace.path}"
EXITCODE=1
ATTEMPTS=0
MAX=3
while [ $EXITCODE -gt 0 ] && [ $ATTEMPTS -lt $MAX ]; do
echo "Starting attempt $ATTEMPTS..."
timeout 3600 terraform destroy -var-file="inputs.tfvars" -no-color -auto-approve -state="${self.triggers_replace.path}/tfstate"
echo "Starting attempt $((ATTEMPTS + 1))..."
timeout 1h terraform destroy -var-file="inputs.tfvars" -no-color -auto-approve -state="${self.triggers_replace.path}/tfstate"
EXITCODE=$?
if [ $EXITCODE -eq 124 ]; then echo "Apply timed out after 1 hour"; fi
ATTEMPTS=$((ATTEMPTS + 1))
echo "Exit code $EXITCODE..."
if [ $EXITCODE -gt 0 ] && [ $ATTEMPTS -lt $MAX ]; then
echo "wait 30 seconds between attempts..."
sleep 30
fi
done
exit $EXITCODE
EOT
Expand Down
2 changes: 1 addition & 1 deletion modules/cluster/main.tf.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ data "http" "myip" {

module "${role}_node" {
source = "rancher/rke2/aws"
version = "1.2.1"
version = "1.2.2"
project_use_strategy = "skip"
project_domain = local.domain
project_domain_zone = local.zone
Expand Down
4 changes: 2 additions & 2 deletions test/scripts/runningPods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ while readyWait && [ "$SUCCESSES" -lt "$SUCCESSES_NEEDED" ]; do
done

if [ "$SUCCESSES" -eq "$SUCCESSES_NEEDED" ]; then
echo "$SUCCESSES_NEEDED reached, passed.."
echo "$SUCCESSES_NEEDED successes reached, passed.."
EXITCODE=0
else
echo "$SUCCESSES_NEEDED not reached, failed.."
echo "$SUCCESSES_NEEDED successes not reached, failed.."
EXITCODE=1
fi

Expand Down