Skip to content

Commit 6e31a3e

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 6e31a3e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,19 @@ 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+
--db-cluster-identifier mavis-${{ inputs.environment }} \
75+
--query "DBClusterSnapshots[].[DBClusterSnapshotArn, SnapshotCreateTime]" \
7576
--output text | sort -k2 -r | head -n 1 | cut -f1)
77+
78+
if [ -z "$SNAPSHOT_ARN" ]; then
79+
echo "No snapshots found for mavis-${{ inputs.environment }}"
80+
exit 1
81+
fi
7682
else
7783
echo "Using provided snapshot ARN: ${{ inputs.db_snapshot_arn }}"
7884
SNAPSHOT_ARN="${{ inputs.db_snapshot_arn }}"
7985
fi
86+
echo "Using snapshot ARN: $SNAPSHOT_ARN"
8087
echo "SNAPSHOT_ARN=$SNAPSHOT_ARN" >> $GITHUB_OUTPUT
8188
- name: Install terraform
8289
uses: hashicorp/setup-terraform@v3

0 commit comments

Comments
 (0)