Skip to content

Commit 57cca5e

Browse files
authored
[PRMT-610] Check on existence of Backup Vault before deleting (#435)
1 parent 2dac59a commit 57cca5e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/cron-tear-down-test.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,21 @@ jobs:
7878

7979
- name: Pre-cleanup AWS Backup Recovery Points
8080
run: |
81+
BACKUP_VAULT_EXISTS=$(aws backup list-backup-vaults \
82+
--region eu-west-2 \
83+
--query "BackupVaultList[?BackupVaultName=='${{ matrix.sandbox-name }}_backup_vault']" \
84+
--output text)
85+
86+
if [ -z "$BACKUP_VAULT_EXISTS" ]; then
87+
exit 0
88+
fi
89+
8190
RECOVERY_POINTS=$(aws backup list-recovery-points-by-backup-vault \
8291
--backup-vault-name ${{ matrix.sandbox-name }}_backup_vault \
8392
--region eu-west-2 \
8493
--query 'RecoveryPoints[*].RecoveryPointArn' \
8594
--output text)
86-
95+
8796
for ARN in $RECOVERY_POINTS; do
8897
echo "Deleting recovery point: $ARN"
8998
aws backup delete-recovery-point \

0 commit comments

Comments
 (0)