diff options
-rwxr-xr-x | scripts/box/restore-backup.env.sh | 7 | ||||
-rwxr-xr-x | scripts/ci/provision.sh | 8 | ||||
-rw-r--r-- | secrets/envrc.sh | bin | 1530 -> 1580 bytes |
3 files changed, 13 insertions, 2 deletions
diff --git a/scripts/box/restore-backup.env.sh b/scripts/box/restore-backup.env.sh index 2c12f21..5eb575b 100755 --- a/scripts/box/restore-backup.env.sh +++ b/scripts/box/restore-backup.env.sh @@ -1,6 +1,13 @@ #!/usr/bin/env bash set -Eeuo pipefail +# Check for ${DOLLAR}{DESTROY_VOLUME} interpolated value +[[ "${DESTROY_VOLUME}" != "" ]] || { + echo "Volume is not fresh." + echo "Skipping restoring from backup." + exit 0 +} + export BORG_REMOTE_PATH="${BORG_REMOTE_PATH}" export BORG_PASSPHRASE="${BORG_PASSPHRASE}" 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..." diff --git a/secrets/envrc.sh b/secrets/envrc.sh Binary files differindex 5811da7..fec3ed7 100644 --- a/secrets/envrc.sh +++ b/secrets/envrc.sh |