aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/deploy.sh
blob: d7d18ffeb76295aa2f7ae181bcefc516552c3960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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

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)
        cd ../terraform/
        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 -auto-approve

        break
        ;;
    No)
        echo "Operation cancelled..."
        exit
        ;;
    esac
done
git.ajschof.me — hosted by ajschofield — powered by cgit