File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
internal/servicedeployer/_static Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,25 @@ cleanup() {
21
21
}
22
22
trap cleanup EXIT INT TERM
23
23
24
+ retry () {
25
+ local retries=$1
26
+ shift
27
+ local count=0
28
+ until " $@ " ; do
29
+ exit=$?
30
+ wait=$(( 2 ** count))
31
+ count=$(( count + 1 ))
32
+ if [ $count -lt " $retries " ]; then
33
+ >&2 echo " Retry $count /$retries exited $exit , retrying in $wait seconds..."
34
+ sleep $wait
35
+ else
36
+ >&2 echo " Retry $count /$retries exited $exit , no more retries left."
37
+ return $exit
38
+ fi
39
+ done
40
+ return 0
41
+ }
42
+
24
43
terraform init
25
44
terraform plan
26
45
@@ -29,7 +48,7 @@ echo "Before Terraform Apply command"
29
48
aws s3api list-buckets --query " Buckets[].Name" --output text | tr ' \t' ' \n'
30
49
31
50
export TF_LOG=" DEBUG"
32
- terraform apply -auto-approve
51
+ retry 3 terraform apply -auto-approve
33
52
34
53
echo " After Terraform Apply command"
35
54
aws s3api list-buckets --query " Buckets[].Name" --output text | tr ' \t' ' \n'
You can’t perform that action at this time.
0 commit comments