Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/data-replication-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,18 @@ jobs:
if [ -z "${{ inputs.db_snapshot_arn }}" ]; then
echo "No snapshot ARN provided, fetching the latest snapshot"
SNAPSHOT_ARN=$(aws rds describe-db-cluster-snapshots \
--query 'DBClusterSnapshots[?contains(DBClusterSnapshotIdentifier, `${{ inputs.environment}}`)].[DBClusterSnapshotArn, SnapshotCreateTime]' \
--query "DBClusterSnapshots[?DBClusterIdentifier=='mavis-${{ inputs.environment }}'].[DBClusterSnapshotArn, SnapshotCreateTime]" \
--output text | sort -k2 -r | head -n 1 | cut -f1)

if [ -z "$SNAPSHOT_ARN" ]; then
echo "No snapshots found for mavis-${{ inputs.environment }}"
exit 1
fi
else
echo "Using provided snapshot ARN: ${{ inputs.db_snapshot_arn }}"
SNAPSHOT_ARN="${{ inputs.db_snapshot_arn }}"
fi
echo "Using snapshot ARN: $SNAPSHOT_ARN"
echo "SNAPSHOT_ARN=$SNAPSHOT_ARN" >> $GITHUB_OUTPUT
- name: Install terraform
uses: hashicorp/setup-terraform@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"Action": ["*"],
"NotResource": [
"arn:aws:s3:::nhse-mavis-terraform-state-production",
"arn:aws:s3:::nhse-mavis-terraform-state"
"arn:aws:s3:::nhse-mavis-terraform-state",
"arn:aws:kms:eu-west-2:*:key/*",
"arn:aws:rds:eu-west-2:*:cluster-snapshot:*"
],
"Condition": {
"StringEquals": {
Expand All @@ -38,6 +40,21 @@
}
}
},
{
"Effect": "Deny",
"Action": [
"kms:Delete*",
"kms:ScheduleKeyDeletion",
"kms:Revoke*",
"kms:Disable*",
"kms:CreateGrant",
"kms:CancelKeyDeletion",
"kms:PutKeyPolicy",
"kms:ReplicateKey",
"kms:RetireGrant"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
"secretsmanager:GetSecretValue",
"secretsmanager:RotateSecret",
"secretsmanager:DeleteSecret",
"secretsmanager:CancelRotateSecret",
"ssm:DeleteParameter",
"ssm:DeleteParameters",
"ssm:PutParameter"
Expand Down