Skip to content

Commit a9f8b68

Browse files
Merge remote-tracking branch 'origin/main' into PRMP-862
2 parents acc91b6 + 69a65bd commit a9f8b68

30 files changed

+340
-42
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!-- markdownlint-disable-next-line first-line-heading -->
2+
## Overview
3+
4+
**Jira ticket**: [TBC](https://nhsd-jira.digital.nhs.uk/browse/XXX)
5+
6+
### Description
7+
8+
<!-- Describe your changes in detail. -->
9+
10+
### Context
11+
12+
<!-- Why is this change required? What problem does it solve? -->
13+
14+
## Checklist
15+
16+
<!--
17+
18+
Put an `x` in the completed tasks.
19+
20+
If a task is not relevant, `x` it, then strike through the text e.g.:
21+
- [x] ~~This task is not relevant.~~
22+
23+
-->
24+
25+
Tasks for all changes:
26+
27+
- [ ] 1. I have linked this PR to its Jira ticket.
28+
- [ ] 2. I have run git pre-commits.
29+
- [ ] 3. I have updated relevant documentation.
30+
- [ ] 4. I have considered the cross-team impact (and have PR approval from both Core & Demographics if necessary).
31+
- [ ] 5. I have successfully [deployed this change to a sandbox](https://github.com/NHSDigital/national-document-repository-infrastructure/actions/workflows/deploy-sandbox.yml) and witnessed it build: [Workflow run: TBC](https://github.com/NHSDigital/national-document-repository-infrastructure/actions/runs/XXX)
32+
- [ ] 6. I have checked the Terraform Plan from this PR against `ndr-dev`.

.github/workflows/automated-pr-validator.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: "Z-AUTOMATED: PR Validator"
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, reopened]
5+
types: [opened, synchronize, reopened, edited]
6+
7+
permissions: {}
68

79
jobs:
810
sbom_scan:
@@ -120,3 +122,23 @@ jobs:
120122
BRANCH_NAME=${{ github.event.repository.default_branch }}
121123
chmod +x scripts/markdown-validator.sh
122124
scripts/markdown-validator.sh
125+
126+
checklist_validator:
127+
name: Checklist Validation
128+
runs-on: ubuntu-latest
129+
permissions:
130+
contents: read
131+
steps:
132+
- name: Checkout repository
133+
uses: actions/checkout@v5
134+
135+
- name: Set up Python 3.11
136+
uses: actions/setup-python@v6
137+
with:
138+
python-version: 3.11
139+
140+
- name: Run checklist validator
141+
run: |
142+
python3 scripts/github/checklist_validator/main.py
143+
env:
144+
PR_BODY: ${{ github.event.pull_request.body }}

.github/workflows/cron-daily-health-check.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ jobs:
119119
runTests: false
120120
build: npm run build
121121
working-directory: ./app
122+
123+
- name: Copy main.html to index.html for serve compatibility
124+
run: cp ./dist/main.html ./dist/index.html
125+
working-directory: ./app
122126

123127
- name: npm install serve -g
124128
run: npm install serve -g

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ tfplan
3636
.idea/
3737
.vscode/
3838
venv/
39+
40+
#Ignore certificates
41+
scripts/csrs
42+
scripts/keys

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ As this repository is a standalone infrastructure there is no python/node based
2929
git config core.hooksPath .githooks
3030
```
3131

32-
Pre-commits will run on any commit. This will build docs and format the terraform.
32+
Pre-commits will run on all commits. This will build docs and format the terraform.

infrastructure/backup-cross-account.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ resource "aws_backup_selection" "cross_account_backup_selection" {
6060
module.bulk_upload_report_dynamodb_table.dynamodb_table_arn,
6161
module.statistical-reports-store.bucket_arn,
6262
module.pdm_dynamodb_table.dynamodb_table_arn,
63-
module.pdm-document-store.bucket_arn
63+
module.pdm-document-store.bucket_arn,
64+
module.core_dynamodb_table.dynamodb_table_arn,
6465
]
6566
}
6667

infrastructure/buckets.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,18 @@ resource "aws_s3_bucket_lifecycle_configuration" "staging-store-lifecycle-rules"
233233
prefix = "user_upload/"
234234
}
235235
}
236+
rule {
237+
id = "Delete objects in review folder that have existed for 24 hours"
238+
status = "Enabled"
239+
240+
expiration {
241+
days = 1
242+
}
243+
244+
filter {
245+
prefix = "review/"
246+
}
247+
}
236248
rule {
237249
id = "default-to-intelligent-tiering"
238250
status = "Enabled"
@@ -281,6 +293,17 @@ resource "aws_s3_bucket_lifecycle_configuration" "ndr_document_pending_review_st
281293
}
282294
filter {}
283295
}
296+
rule {
297+
id = "remove-delete-markers-after-42-days"
298+
status = "Enabled"
299+
expiration {
300+
expired_object_delete_marker = true
301+
}
302+
noncurrent_version_expiration {
303+
noncurrent_days = 42
304+
}
305+
filter {}
306+
}
284307
}
285308

286309
# Logging Buckets

infrastructure/dev.tfvars

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ cloud_security_email_param_environment = "dev"
1212
apim_environment = "internal-dev."
1313

1414
kms_deletion_window = 7
15+
16+
ssh_key_management_dry_run = true

infrastructure/dynamo_db_review.tf

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
module "document_review_dynamodb_table" {
2-
count = local.is_production ? 0 : 1
1+
module "document_upload_review_dynamodb_table" {
32
source = "./modules/dynamo_db"
43
table_name = var.document_review_table_name
54
hash_key = "ID"
5+
sort_key = "Version"
66
deletion_protection_enabled = local.is_production
77
stream_enabled = false
8-
ttl_enabled = true
9-
ttl_attribute_name = "TTL"
8+
ttl_enabled = false
109
point_in_time_recovery_enabled = !local.is_sandbox
1110

1211
attributes = [
@@ -36,11 +35,15 @@ module "document_review_dynamodb_table" {
3635
},
3736
{
3837
name = "ReviewDate"
39-
type = "S"
38+
type = "N"
4039
},
4140
{
4241
name = "UploadDate"
4342
type = "N"
43+
},
44+
{
45+
name = "Version"
46+
type = "N"
4447
}
4548

4649
]

infrastructure/lambda-document-review-processor.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ module "document_review_processor_lambda" {
66
module.document_review_queue.sqs_read_policy_document,
77
module.document_review_queue.sqs_write_policy_document,
88
module.ndr-document-pending-review-store.s3_write_policy_document,
9-
local.is_production ? "" : module.document_review_dynamodb_table[0].dynamodb_read_policy_document,
10-
local.is_production ? "" : module.document_review_dynamodb_table[0].dynamodb_write_policy_document,
9+
module.document_upload_review_dynamodb_table.dynamodb_read_policy_document,
10+
module.document_upload_review_dynamodb_table.dynamodb_write_policy_document,
1111
module.ndr-bulk-staging-store.s3_read_policy_document,
1212
module.ndr-bulk-staging-store.s3_write_policy_document,
1313
]
@@ -21,7 +21,7 @@ module "document_review_processor_lambda" {
2121
lambda_environment_variables = {
2222
PENDING_REVIEW_BUCKET_NAME = module.ndr-document-pending-review-store.bucket_id
2323
STAGING_STORE_BUCKET_NAME = module.ndr-bulk-staging-store.bucket_id
24-
DOCUMENT_REVIEW_DYNAMODB_NAME = local.is_production ? "" : module.document_review_dynamodb_table[0].table_name
24+
DOCUMENT_REVIEW_DYNAMODB_NAME = module.document_upload_review_dynamodb_table.table_name
2525
WORKSPACE = terraform.workspace
2626
}
2727
}

0 commit comments

Comments
 (0)