Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
holi-unified-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
app
holi-unified-api
Commits
56765b79
Commit
56765b79
authored
5 months ago
by
Ole Langbehn
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' into production
parents
71e393af
701a68ba
No related branches found
Branches containing commit
Tags
release/1.43.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
terraform/environments/scripts/destroy-env.sh
+29
-4
29 additions, 4 deletions
terraform/environments/scripts/destroy-env.sh
with
30 additions
and
4 deletions
.gitignore
+
1
−
0
View file @
56765b79
...
@@ -13,3 +13,4 @@ node_modules/
...
@@ -13,3 +13,4 @@ node_modules/
!.yarn/releases
!.yarn/releases
!.yarn/sdks
!.yarn/sdks
!.yarn/versions
!.yarn/versions
terraform*.log
This diff is collapsed.
Click to expand it.
terraform/environments/scripts/destroy-env.sh
+
29
−
4
View file @
56765b79
#!/usr/bin/env sh
#!/usr/bin/env
ba
sh
# exit when any command fails
# exit when any command fails
set
-ex
set
-ex
...
@@ -6,11 +6,36 @@ set -ex
...
@@ -6,11 +6,36 @@ set -ex
# enable debug output in terraform
# enable debug output in terraform
export
TF_LOG
=
DEBUG
export
TF_LOG
=
DEBUG
cd
terraform/environments
# retry logic for destroy: sometimes, a full workspace destroy does not work. This can be due to e.g.:
# * implicit dependencies between terraform resources not declared with depends_on,
# * unclean shutdown of resources, e.g. service does not close db connections, db still sees clients connected,
# * GCP stuff not allowing our resources to be deleted.
# Most of the time, retrying a destroy fixes these causes.
retry
()
{
for
i
in
{
1..3
}
;
do
set
+e
"
$@
"
retval
=
$?
set
-e
if
[
"
$retval
"
-ne
"0"
]
;
then
if
[
"
$i
"
-lt
"3"
]
;
then
echo
"command '
$*
' failed in try
$i
, retrying after 60 seconds"
sleep
60
# let things settle a bit
else
echo
"command '
$*
' failed in try
$i
, giving up"
exit
$retval
fi
else
break
# success
fi
done
}
cd
"
$(
dirname
"
$0
"
)
"
/..
TF_LOG_PATH
=
terraform-init.log terraform init
TF_LOG_PATH
=
terraform-init.log terraform init
TF_LOG_PATH
=
terraform-version.log terraform version
TF_LOG_PATH
=
terraform-version.log terraform version
TF_LOG_PATH
=
terraform-workspace.log terraform workspace
new
"
$1
"
||
terraform workspace
select
"
$1
"
TF_LOG_PATH
=
terraform-workspace.log terraform workspace
select
-or-create
=
true
"
$1
"
TF_LOG_PATH
=
terraform-destroy.log terraform destroy
-auto-approve
-var
=
"image_tag=dummy"
TF_LOG_PATH
=
terraform-destroy.log
retry
terraform destroy
-auto-approve
-var
=
"image_tag=dummy"
TF_LOG_PATH
=
terraform-ws-default.log terraform workspace
select
default
TF_LOG_PATH
=
terraform-ws-default.log terraform workspace
select
default
TF_LOG_PATH
=
terraform-ws-delete.log terraform workspace delete
"
$1
"
TF_LOG_PATH
=
terraform-ws-delete.log terraform workspace delete
"
$1
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment