diff options
author | EuAndreh <eu@euandre.org> | 2019-06-05 19:48:18 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2019-06-05 19:48:50 -0300 |
commit | f370619fbb34ba5f59d4955a24939f15dedc72d0 (patch) | |
tree | 5b751040bf2df3aa370678533401fb2cc6229bf9 | |
parent | Script: rotate SSH keys (diff) | |
download | server-f370619fbb34ba5f59d4955a24939f15dedc72d0.tar.gz server-f370619fbb34ba5f59d4955a24939f15dedc72d0.tar.xz |
Always destroy infrastructure before applying
-rw-r--r-- | TODOs.org | 3 | ||||
-rwxr-xr-x | scripts/ci/provision.sh | 4 |
2 files changed, 6 insertions, 1 deletions
@@ -130,7 +130,8 @@ Also put all of the content of =secrets/*= into vps-state? Maybe rename it to vp Right now, secrets are scattered between the two repositories. By moving I can completely remove =git-crypt= from this repository. ** TODO Run backup on Terraform destroy action instead of manually in =provision.sh= -** TODO Explicitly destroy Droplets before running Terraform apply? +** DONE Explicitly destroy Droplets before running Terraform apply +CLOSED: [2019-06-05 Wed 19:48] ** TODO Store updated =.tfstate= even in case of deployment failure Right now the script fails on Terraform commands before reaching git commands. I should trap the error, store on git and only then fail. ** TODO Fix alias in =bash-profile.sh= diff --git a/scripts/ci/provision.sh b/scripts/ci/provision.sh index 1000a55..b72a0f5 100755 --- a/scripts/ci/provision.sh +++ b/scripts/ci/provision.sh @@ -18,6 +18,10 @@ envsubst < ./scripts/box/run-backup.env.sh | ssh "$TLD" 'cat > /home/vps/run-bac ssh "$TLD" /home/vps/run-backup.sh echo "Done." +echo "Destroying existing infrastructure..." +terraform destroy -input=false -auto-approve +echo "Done." + echo "Running 'terraform plan' and storing the planfile..." terraform --version terraform init |