Skip to content

Commit 925d6d1

Browse files
authored
Merge branch 'main' into feature/CCM-15257_update_v4_github_actions
2 parents 2e77bf2 + f713f1a commit 925d6d1

50 files changed

Lines changed: 824 additions & 620 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
- [ ] This PR is a result of pair or mob programming
2828
<!-- - [ ] If I have used the 'skip-trivy-package' label I have done so responsibly and in the knowledge that this is being fixed as part of a separate ticket/PR. TODO - Re-visit Trivy usage https://nhsd-jira.digital.nhs.uk/browse/CCM-15549 -->
2929

30+
## DT3-Specific Checklist
31+
32+
<!-- Go over all the following points, and put an `x` in all the boxes that apply. -->
33+
34+
- [ ] If I have added a new resource (SQS, Lambda, Gateway, DDB table, etc), I have created the appropriate alarms
35+
3036
---
3137

3238
## Sensitive Information Declaration

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
"**/Thumbs.db": true,
1111
".github": false,
1212
".vscode": false
13-
}
13+
},
14+
"js/ts.tsdk.path": "node_modules/typescript/lib"
1415
}

infrastructure/terraform/components/api/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ No requirements.
3737
| <a name="input_kms_deletion_window"></a> [kms\_deletion\_window](#input\_kms\_deletion\_window) | When a kms key is deleted, how long should it wait in the pending deletion state? | `string` | `"30"` | no |
3838
| <a name="input_letter_event_source"></a> [letter\_event\_source](#input\_letter\_event\_source) | Source value to use for the letter status event updates | `string` | `"/data-plane/supplier-api/nhs-supplier-api-prod/main/update-status"` | no |
3939
| <a name="input_letter_table_ttl_hours"></a> [letter\_table\_ttl\_hours](#input\_letter\_table\_ttl\_hours) | Number of hours to set as TTL on letters table | `number` | `24` | no |
40-
| <a name="input_letter_variant_map"></a> [letter\_variant\_map](#input\_letter\_variant\_map) | n/a | `map(object({ supplierId = string, specId = string, priority = number, billingId = string }))` | <pre>{<br/> "lv1": {<br/> "billingId": "billing1",<br/> "priority": 10,<br/> "specId": "spec1",<br/> "supplierId": "supplier1"<br/> },<br/> "lv2": {<br/> "billingId": "billing1",<br/> "priority": 10,<br/> "specId": "spec2",<br/> "supplierId": "supplier1"<br/> },<br/> "lv3": {<br/> "billingId": "billing1",<br/> "priority": 10,<br/> "specId": "spec3",<br/> "supplierId": "supplier2"<br/> }<br/>}</pre> | no |
40+
| <a name="input_letter_variant_map"></a> [letter\_variant\_map](#input\_letter\_variant\_map) | n/a | `map(object({ supplierId = string, specId = string, priority = number, billingId = string }))` | <pre>{<br/> "digitrials-aspiring": {<br/> "billingId": "digitrials-aspiring-billing",<br/> "priority": "0",<br/> "specId": "digitrials-aspiring",<br/> "supplierId": "supplier1"<br/> },<br/> "digitrials-dmapp": {<br/> "billingId": "notify-admail-billing",<br/> "priority": "1",<br/> "specId": "notify-admail",<br/> "supplierId": "supplier1"<br/> },<br/> "digitrials-globalminds": {<br/> "billingId": "digitrials-globalminds-billing",<br/> "priority": "2",<br/> "specId": "digitrials-globalminds",<br/> "supplierId": "supplier1"<br/> },<br/> "digitrials-mymelanoma": {<br/> "billingId": "digitrials-mymelanoma-billing",<br/> "priority": "3",<br/> "specId": "digitrials-mymelanoma",<br/> "supplierId": "supplier1"<br/> },<br/> "digitrials-ofh": {<br/> "billingId": "digitrials-ofh-billing",<br/> "priority": "4",<br/> "specId": "digitrials-ofh",<br/> "supplierId": "supplier1"<br/> },<br/> "digitrials-prostateprogress": {<br/> "billingId": "digitrials-prostateprogress-billing",<br/> "priority": "5",<br/> "specId": "digitrials-prostateprogress",<br/> "supplierId": "supplier1"<br/> },<br/> "digitrials-protectc": {<br/> "billingId": "notify-c5-colour-billing",<br/> "priority": "6",<br/> "specId": "notify-c5-colour",<br/> "supplierId": "supplier1"<br/> },<br/> "digitrials-restore": {<br/> "billingId": "digitrials-restore-billing",<br/> "priority": "7",<br/> "specId": "digitrials-restore",<br/> "supplierId": "supplier1"<br/> },<br/> "gpreg-admail": {<br/> "billingId": "notify-admail-billing",<br/> "priority": "8",<br/> "specId": "notify-admail",<br/> "supplierId": "supplier1"<br/> },<br/> "nces-abnormal-results": {<br/> "billingId": "nces-abnormal-results-billing",<br/> "priority": "9",<br/> "specId": "nces-abnormal-results",<br/> "supplierId": "supplier1"<br/> },<br/> "nces-abnormal-results-braille": {<br/> "billingId": "nces-abnormal-results-braille-billing",<br/> "priority": "10",<br/> "specId": "nces-abnormal-results-braille",<br/> "supplierId": "supplier1"<br/> },<br/> "nces-invites": {<br/> "billingId": "nces-invites-billing",<br/> "priority": "10",<br/> "specId": "nces-invites",<br/> "supplierId": "supplier1"<br/> },<br/> "nces-invites-braille": {<br/> "billingId": "nces-invites-braille-billing",<br/> "priority": "10",<br/> "specId": "nces-invites-braille",<br/> "supplierId": "supplier1"<br/> },<br/> "nces-standard": {<br/> "billingId": "notify-c5-whitemail-billing",<br/> "priority": "11",<br/> "specId": "notify-c5-whitemail",<br/> "supplierId": "supplier1"<br/> },<br/> "nces-standard-braille": {<br/> "billingId": "notify-braille-whitemail-billing",<br/> "priority": "12",<br/> "specId": "notify-braille-whitemail",<br/> "supplierId": "supplier1"<br/> },<br/> "notify-braille": {<br/> "billingId": "notify-braille-billing",<br/> "priority": "13",<br/> "specId": "notify-braille",<br/> "supplierId": "supplier1"<br/> },<br/> "notify-digital-letters-standard": {<br/> "billingId": "notify-c5-billing",<br/> "priority": "97",<br/> "specId": "notify-c5",<br/> "supplierId": "supplier1"<br/> },<br/> "notify-standard": {<br/> "billingId": "notify-c5-billing",<br/> "priority": "98",<br/> "specId": "notify-c5",<br/> "supplierId": "supplier1"<br/> },<br/> "notify-standard-colour": {<br/> "billingId": "notify-c5-colour-billing",<br/> "priority": "99",<br/> "specId": "notify-c5-colour",<br/> "supplierId": "supplier1"<br/> }<br/>}</pre> | no |
4141
| <a name="input_log_level"></a> [log\_level](#input\_log\_level) | The log level to be used in lambda functions within the component. Any log with a lower severity than the configured value will not be logged: https://docs.python.org/3/library/logging.html#levels | `string` | `"INFO"` | no |
4242
| <a name="input_log_retention_in_days"></a> [log\_retention\_in\_days](#input\_log\_retention\_in\_days) | The retention period in days for the Cloudwatch Logs events to be retained, default of 0 is indefinite | `number` | `0` | no |
4343
| <a name="input_manually_configure_mtls_truststore"></a> [manually\_configure\_mtls\_truststore](#input\_manually\_configure\_mtls\_truststore) | Manually manage the truststore used for API Gateway mTLS (e.g. for prod environment) | `bool` | `false` | no |

infrastructure/terraform/components/api/locals.tf

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,19 @@ locals {
2222
destination_arn = "arn:aws:logs:${var.region}:${var.shared_infra_account_id}:destination:nhs-main-obs-firehose-logs"
2323

2424
common_lambda_env_vars = {
25-
APIM_CORRELATION_HEADER = "nhsd-correlation-id",
26-
DOWNLOAD_URL_TTL_SECONDS = 60
27-
EVENT_SOURCE = "/data-plane/supplier-api/${var.group}/${var.environment}/letters"
28-
LETTER_TTL_HOURS = 12960, # 18 months * 30 days * 24 hours
29-
LETTERS_TABLE_NAME = aws_dynamodb_table.letters.name,
30-
MI_TABLE_NAME = aws_dynamodb_table.mi.name,
31-
MI_TTL_HOURS = 2160 # 90 days * 24 hours
32-
SNS_TOPIC_ARN = "${module.eventsub.sns_topic.arn}",
33-
SUPPLIER_CONFIG_TABLE_NAME = aws_dynamodb_table.supplier-configuration.name
34-
SUPPLIER_ID_HEADER = "nhsd-supplier-id",
25+
APIM_CORRELATION_HEADER = "nhsd-correlation-id",
26+
DOWNLOAD_URL_TTL_SECONDS = 60
27+
EVENT_SOURCE = "/data-plane/supplier-api/${var.group}/${var.environment}/letters"
28+
LETTER_TTL_HOURS = 12960, # 18 months * 30 days * 24 hours
29+
LETTER_QUEUE_TABLE_NAME = aws_dynamodb_table.letter_queue.name,
30+
LETTER_QUEUE_TTL_HOURS = 168 # 7 days * 24 hours
31+
LETTER_QUEUE_VISIBILITY_TIMEOUT = 300, # 5 minutes * 60 seconds
32+
LETTERS_TABLE_NAME = aws_dynamodb_table.letters.name,
33+
MI_TABLE_NAME = aws_dynamodb_table.mi.name,
34+
MI_TTL_HOURS = 2160 # 90 days * 24 hours
35+
SNS_TOPIC_ARN = "${module.eventsub.sns_topic.arn}",
36+
SUPPLIER_CONFIG_TABLE_NAME = aws_dynamodb_table.supplier-configuration.name
37+
SUPPLIER_ID_HEADER = "nhsd-supplier-id",
3538
}
3639

3740
core_pdf_bucket_arn = "arn:aws:s3:::comms-${var.core_account_id}-eu-west-2-${var.core_environment}-api-stg-pdf-pipeline"

infrastructure/terraform/components/api/module_lambda_get_letters.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@ data "aws_iam_policy_document" "get_letters_lambda" {
6363
"dynamodb:GetItem",
6464
"dynamodb:Query",
6565
"dynamodb:Scan",
66+
"dynamodb:UpdateItem",
6667
]
6768

6869
resources = [
69-
aws_dynamodb_table.letters.arn,
70-
"${aws_dynamodb_table.letters.arn}/index/supplierStatus-index"
70+
aws_dynamodb_table.letter_queue.arn,
71+
"${aws_dynamodb_table.letter_queue.arn}/index/queueSortOrder-index"
7172
]
7273
}
7374
}

infrastructure/terraform/components/api/module_lambda_update_letter_queue.tf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ module "update_letter_queue" {
3434
log_destination_arn = local.destination_arn
3535
log_subscription_role_arn = local.acct.log_subscription_role_arn
3636

37-
lambda_env_vars = merge(local.common_lambda_env_vars, {
38-
LETTER_QUEUE_TABLE_NAME = "${local.csi}-letter-queue",
39-
LETTER_QUEUE_TTL_HOURS = 168 # 7 days
40-
})
37+
lambda_env_vars = merge(local.common_lambda_env_vars, {})
4138
}
4239

4340
data "aws_iam_policy_document" "update_letter_queue_lambda" {

infrastructure/terraform/components/api/variables.tf

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,25 @@ variable "eventpub_control_plane_bus_arn" {
138138
variable "letter_variant_map" {
139139
type = map(object({ supplierId = string, specId = string, priority = number, billingId = string }))
140140
default = {
141-
"lv1" = { supplierId = "supplier1", specId = "spec1", priority = 10, billingId = "billing1" },
142-
"lv2" = { supplierId = "supplier1", specId = "spec2", priority = 10, billingId = "billing1" },
143-
"lv3" = { supplierId = "supplier2", specId = "spec3", priority = 10, billingId = "billing1" }
141+
"digitrials-aspiring" = { supplierId = "supplier1", specId = "digitrials-aspiring", priority = "0", billingId = "digitrials-aspiring-billing" },
142+
"digitrials-dmapp" = { supplierId = "supplier1", specId = "notify-admail", priority = "1", billingId = "notify-admail-billing" },
143+
"digitrials-globalminds" = { supplierId = "supplier1", specId = "digitrials-globalminds", priority = "2", billingId = "digitrials-globalminds-billing" },
144+
"digitrials-mymelanoma" = { supplierId = "supplier1", specId = "digitrials-mymelanoma", priority = "3", billingId = "digitrials-mymelanoma-billing" },
145+
"digitrials-ofh" = { supplierId = "supplier1", specId = "digitrials-ofh", priority = "4", billingId = "digitrials-ofh-billing" },
146+
"digitrials-prostateprogress" = { supplierId = "supplier1", specId = "digitrials-prostateprogress", priority = "5", billingId = "digitrials-prostateprogress-billing" },
147+
"digitrials-protectc" = { supplierId = "supplier1", specId = "notify-c5-colour", priority = "6", billingId = "notify-c5-colour-billing" },
148+
"digitrials-restore" = { supplierId = "supplier1", specId = "digitrials-restore", priority = "7", billingId = "digitrials-restore-billing" },
149+
"gpreg-admail" = { supplierId = "supplier1", specId = "notify-admail", priority = "8", billingId = "notify-admail-billing" },
150+
"nces-abnormal-results" = { supplierId = "supplier1", specId = "nces-abnormal-results", priority = "9", billingId = "nces-abnormal-results-billing" },
151+
"nces-abnormal-results-braille" = { supplierId = "supplier1", specId = "nces-abnormal-results-braille", priority = "10", billingId = "nces-abnormal-results-braille-billing" },
152+
"nces-invites" = { supplierId = "supplier1", specId = "nces-invites", priority = "10", billingId = "nces-invites-billing" },
153+
"nces-invites-braille" = { supplierId = "supplier1", specId = "nces-invites-braille", priority = "10", billingId = "nces-invites-braille-billing" },
154+
"nces-standard" = { supplierId = "supplier1", specId = "notify-c5-whitemail", priority = "11", billingId = "notify-c5-whitemail-billing" },
155+
"nces-standard-braille" = { supplierId = "supplier1", specId = "notify-braille-whitemail", priority = "12", billingId = "notify-braille-whitemail-billing" },
156+
"notify-braille" = { supplierId = "supplier1", specId = "notify-braille", priority = "13", billingId = "notify-braille-billing" },
157+
"notify-digital-letters-standard" = { supplierId = "supplier1", specId = "notify-c5", priority = "97", billingId = "notify-c5-billing" },
158+
"notify-standard" = { supplierId = "supplier1", specId = "notify-c5", priority = "98", billingId = "notify-c5-billing" },
159+
"notify-standard-colour" = { supplierId = "supplier1", specId = "notify-c5-colour", priority = "99", billingId = "notify-c5-colour-billing" }
144160
}
145161
}
146162

0 commit comments

Comments
 (0)