aboutsummaryrefslogtreecommitdiff
path: root/scripts/ci
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2019-06-06 23:56:44 -0300
committerEuAndreh <eu@euandre.org>2019-06-06 23:56:44 -0300
commitd9c407a182498a75fba19ea6cd3bb5cc2535ed6b (patch)
treeac58bd1b5b3aa26426a78d1faf2baad5a6198d24 /scripts/ci
parentUncomment docker-compose starting Ansible task (diff)
downloadserver-d9c407a182498a75fba19ea6cd3bb5cc2535ed6b.tar.gz
server-d9c407a182498a75fba19ea6cd3bb5cc2535ed6b.tar.xz
Add ${DESTROY_VOLUME} operational toggle
This way I can dynamically control whether to destroy and recreate all the existing infrastructure entirely from scratch. The advantages of doing so are: - test the non-existence of local state on every deployment; - make sure I can always recreate everything from scratch. The disadvantages are: - slower deployment times; - longer downtime during deployments.
Diffstat (limited to 'scripts/ci')
-rwxr-xr-xscripts/ci/provision.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/ci/provision.sh b/scripts/ci/provision.sh
index 5d7b96b..e2a0c72 100755
--- a/scripts/ci/provision.sh
+++ b/scripts/ci/provision.sh
@@ -32,8 +32,12 @@ terraform --version
terraform init
echo "Done."
-echo "Destroying existing infrastructure..."
-terraform destroy -input=false -auto-approve
+if [[ "${DESTROY_VOLUME:-}" != "" ]]; then
+ echo "Skipping explicit intentional destruction of existing infrastructure..."
+else
+ echo "Destroying existing infrastructure..."
+ terraform destroy -input=false -auto-approve
+fi
echo "Done."
echo "Running 'terraform plan' and storing the planfile..."