Skip to content

Commit 68d6701

Browse files
committed
Select only production DB snapshots to recreate DB from
* The data replication DB itself is being automatically backed up. This can't be turned off. We need to change the selector in a way that it only matches snapshots of the Production DB and not the data replication snapshots
1 parent 99a4a8c commit 68d6701

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/data-replication-pipeline.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,18 @@ jobs:
7171
if [ -z "${{ inputs.db_snapshot_arn }}" ]; then
7272
echo "No snapshot ARN provided, fetching the latest snapshot"
7373
SNAPSHOT_ARN=$(aws rds describe-db-cluster-snapshots \
74-
--query 'DBClusterSnapshots[?contains(DBClusterSnapshotIdentifier, `${{ inputs.environment}}`)].[DBClusterSnapshotArn, SnapshotCreateTime]' \
74+
--query "DBClusterSnapshots[?DBClusterIdentifier==`mavis-${{ inputs.environment }}`].[DBClusterSnapshotArn, SnapshotCreateTime]" \
7575
--output text | sort -k2 -r | head -n 1 | cut -f1)
76+
77+
if [ -z "$SNAPSHOT_ARN" ]; then
78+
echo "No snapshots found for mavis-${{ inputs.environment }}"
79+
exit 1
80+
fi
7681
else
7782
echo "Using provided snapshot ARN: ${{ inputs.db_snapshot_arn }}"
7883
SNAPSHOT_ARN="${{ inputs.db_snapshot_arn }}"
7984
fi
85+
echo "Using snapshot ARN: $SNAPSHOT_ARN"
8086
echo "SNAPSHOT_ARN=$SNAPSHOT_ARN" >> $GITHUB_OUTPUT
8187
- name: Install terraform
8288
uses: hashicorp/setup-terraform@v3

0 commit comments

Comments
 (0)