aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/deploy.sh
diff options
context:
space:
mode:
authorAlex <git@ajschof.me>2024-08-20 15:31:05 +0100
committerGitHub <noreply@github.com>2024-08-20 15:31:05 +0100
commit80f531f3756c2db095dce0b0aee30e537d711566 (patch)
tree671b2817d4576abd1132aded13f25ba545beff90 /scripts/deploy.sh
parent3ab3164c2e6f0e7a7ae6755a58914522bf3390a6 (diff)
parenta393d59e052d3a37d66f7a657a15cad1d486e3b1 (diff)
downloadde-project-bentley-80f531f3756c2db095dce0b0aee30e537d711566.tar.gz
de-project-bentley-80f531f3756c2db095dce0b0aee30e537d711566.zip
Merge pull request #76 from ajschofield/development
pr: pull development into main
Diffstat (limited to 'scripts/deploy.sh')
-rwxr-xr-xscripts/deploy.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/deploy.sh b/scripts/deploy.sh
new file mode 100755
index 0000000..f631bbc
--- /dev/null
+++ b/scripts/deploy.sh
@@ -0,0 +1,56 @@
+# Deploy Script
+# Description: Deploy and destroy Terraform
+# WARNING: This will most likely destroy any current infrastructure if protections
+# are not in place. Be careful!
+
+# Exit if any command has a non-zero status
+set -e
+
+# Change current directory to terraform folder at the start
+cd ../terraform/
+
+echo "WARNING: This script will destroy any infrastructure for testing."
+echo "It should not be used once a proper deployment has been setup."
+echo "Would you like to continue?"
+
+select yn in "Yes" "No"; do
+ case $yn in
+ Yes)
+ echo "Would you like to destroy the current infrastructure?"
+ select destroy_1 in "Yes" "No"; do
+ case $destroy_1 in
+ Yes)
+ terraform destroy
+ break
+ ;;
+ No)
+ echo "Skipping initial destroy..."
+ break
+ ;;
+ esac
+ done
+
+ terraform apply
+
+ echo "Would you like to destroy the newly-created infrastructure?"
+ select destroy_2 in "Yes" "No"; do
+ case $destroy_2 in
+ Yes)
+ terraform destroy
+ break
+ ;;
+ No)
+ echo "Skipping final destroy... Infrastructure will remain."
+ break
+ ;;
+ esac
+ done
+
+ break
+ ;;
+ No)
+ echo "Operation cancelled..."
+ exit
+ ;;
+ esac
+done
git.ajschof.me — hosted by ajschofield — powered by cgit