Skip to content

Commit

Permalink
Break teardown into separate scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenfrederick committed Aug 9, 2021
1 parent 0a084c0 commit 73d69d2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ COPY docker/deployment-one-time-setup.sh /build/
COPY docker/prep-deployments.sh /build/
COPY docker/deploy-cumulus.sh /build/
COPY docker/teardown.sh /build/
COPY docker/teardown-one-time-setup.sh /build/
COPY docker/deploy-all.sh /build/
COPY docker/print-connection-commands.sh /

Expand Down
10 changes: 9 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ To save money and resources, when finished with your Cumulus deployment you can

`sh build/teardown.sh`

then, upon success:

`sh build/teardown-one-time-setup.sh`

Teardown output can be viewed in the console.

# Scripts
Expand All @@ -149,7 +153,11 @@ Execute one-time setup steps for the deployment.

## teardown.sh

Tears down all resources deployed by `deploy-all.sh` and `build/deployment-one-time-setup.sh`.
Tears down all resources deployed by `deploy-all.sh`.

## teardown-one-time-setup.sh

Tears down all resources deployed by `build/deployment-one-time-setup.sh`. This is separate from `teardown.sh` to make sure the teardown function is complete before tearing down buckets, particularly the tf-state bucket.

## print-connection-commands.sh

Expand Down
18 changes: 18 additions & 0 deletions docker/teardown-one-time-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e

### TEARDOWN TEA SECRET ###

echo Cleaning up TEA secret for prefix $PREFIX

aws secretsmanager delete-secret --secret-id $PREFIX"_jwt_secret_for_tea" --force-delete-without-recovery

### TEARDOWN BUCKETS ###

echo Cleaning up buckets for prefix $PREFIX

aws s3 rb s3://$PREFIX-tf-state --force
aws s3 rb s3://$PREFIX-internal --force
aws s3 rb s3://$PREFIX-public --force
aws s3 rb s3://$PREFIX-private --force
aws s3 rb s3://$PREFIX-protected --force
12 changes: 0 additions & 12 deletions docker/teardown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ cd deploy/cumulus-tf

../../terraform destroy -auto-approve -input=false

### TEARDOWN TEA SECRET ###

aws secretsmanager delete-secret --secret-id $PREFIX"_jwt_secret_for_tea" --force-delete-without-recovery

### TEARDOWN DATA MIGRATION ###

echo Tearing down Data Migration
Expand Down Expand Up @@ -54,14 +50,6 @@ cd ../rds-cluster-tf

../../terraform destroy -auto-approve -input=false

### TEARDOWN BUCKETS ###

aws s3 rb s3://$PREFIX-tf-state --force
aws s3 rb s3://$PREFIX-internal --force
aws s3 rb s3://$PREFIX-public --force
aws s3 rb s3://$PREFIX-private --force
aws s3 rb s3://$PREFIX-protected --force

### TEARDOWN CLEANUP ###

rm -rf ../data-persistence-delete

0 comments on commit 73d69d2

Please sign in to comment.