diff options
| author | Alex <git@ajschof.me> | 2024-08-19 21:52:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-19 21:52:53 +0100 |
| commit | f93636f2808b1fbed900b162aed9c6420bfb1aa5 (patch) | |
| tree | 7434b978db351717d0679422e580919bcaf852ca /scripts | |
| parent | ed20a8dbeba8b88226e539673a6326e75a73746e (diff) | |
| parent | ce2761b311523a118cdead885ba7fcf1f7a4cd68 (diff) | |
| download | de-project-bentley-f93636f2808b1fbed900b162aed9c6420bfb1aa5.tar.gz de-project-bentley-f93636f2808b1fbed900b162aed9c6420bfb1aa5.zip | |
Merge pull request #66 from ajschofield/alex/tf-improvements
pr: terraform improvements
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/deploy.sh | 56 |
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 |
