Skip to content

Commit 96a241d

Browse files
committed
Merge branch 'main' into feature/CCM-12616_mesh_poll_retrieve
2 parents e4a64c7 + a474d08 commit 96a241d

59 files changed

Lines changed: 3651 additions & 5958 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/actions/trivy-iac/action.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ runs:
88
run: |
99
components_exit_code=0
1010
modules_exit_code=0
11-
11+
asdf plugin add trivy || true
12+
asdf install trivy || true
1213
./scripts/terraform/trivy-scan.sh --mode iac ./infrastructure/terraform/components || components_exit_code=$?
1314
./scripts/terraform/trivy-scan.sh --mode iac ./infrastructure/terraform/modules || modules_exit_code=$?
1415

.github/actions/trivy-package/action.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ runs:
77
shell: bash
88
run: |
99
exit_code=0
10-
10+
asdf plugin add trivy || true
11+
asdf install trivy || true
1112
./scripts/terraform/trivy-scan.sh --mode package . || exit_code=$?
1213
1314
if [ $exit_code -ne 0 ]; then

.github/workflows/stage-1-commit.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,6 @@ jobs:
163163
uses: actions/checkout@v4
164164
- name: "Setup ASDF"
165165
uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47 # v4
166-
- name: "Perform Setup"
167-
uses: ./.github/actions/setup
168166
- name: "Trivy IaC Scan"
169167
uses: ./.github/actions/trivy-iac
170168
trivy-package:
@@ -179,8 +177,6 @@ jobs:
179177
uses: actions/checkout@v4
180178
- name: "Setup ASDF"
181179
uses: asdf-vm/actions/setup@1902764435ca0dd2f3388eea723a4f92a4eb8302
182-
- name: "Perform Setup"
183-
uses: ./.github/actions/setup
184180
- name: "Trivy Package Scan"
185181
uses: ./.github/actions/trivy-package
186182
count-lines-of-code:

infrastructure/terraform/components/dl/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ No requirements.
3232
| <a name="input_pdm_use_non_mock_token"></a> [pdm\_use\_non\_mock\_token](#input\_pdm\_use\_non\_mock\_token) | Whether to use the shared APIM access token from SSM (/component/environment/apim/access\_token) instead of the mock token | `bool` | `false` | no |
3333
| <a name="input_project"></a> [project](#input\_project) | The name of the tfscaffold project | `string` | n/a | yes |
3434
| <a name="input_queue_batch_size"></a> [queue\_batch\_size](#input\_queue\_batch\_size) | maximum number of queue items to process | `number` | `10` | no |
35-
| <a name="input_queue_batch_window_seconds"></a> [queue\_batch\_window\_seconds](#input\_queue\_batch\_window\_seconds) | maximum time in seconds between processing events | `number` | `10` | no |
35+
| <a name="input_queue_batch_window_seconds"></a> [queue\_batch\_window\_seconds](#input\_queue\_batch\_window\_seconds) | maximum time in seconds between processing events | `number` | `1` | no |
3636
| <a name="input_region"></a> [region](#input\_region) | The AWS Region | `string` | n/a | yes |
3737
| <a name="input_shared_infra_account_id"></a> [shared\_infra\_account\_id](#input\_shared\_infra\_account\_id) | The AWS Shared Infra Account ID (numeric) | `string` | n/a | yes |
3838
| <a name="input_ttl_poll_schedule"></a> [ttl\_poll\_schedule](#input\_ttl\_poll\_schedule) | Schedule to poll for any overdue TTL records | `string` | `"rate(10 minutes)"` | no |
@@ -46,6 +46,7 @@ No requirements.
4646
| <a name="module_mesh_download"></a> [mesh\_download](#module\_mesh\_download) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
4747
| <a name="module_mesh_poll"></a> [mesh\_poll](#module\_mesh\_poll) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
4848
| <a name="module_pdm_mock"></a> [pdm\_mock](#module\_pdm\_mock) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
49+
| <a name="module_pdm_poll"></a> [pdm\_poll](#module\_pdm\_poll) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
4950
| <a name="module_pdm_uploader"></a> [pdm\_uploader](#module\_pdm\_uploader) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip | n/a |
5051
| <a name="module_s3bucket_cf_logs"></a> [s3bucket\_cf\_logs](#module\_s3bucket\_cf\_logs) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.24/terraform-s3bucket.zip | n/a |
5152
| <a name="module_s3bucket_letters"></a> [s3bucket\_letters](#module\_s3bucket\_letters) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.24/terraform-s3bucket.zip | n/a |
@@ -54,6 +55,7 @@ No requirements.
5455
| <a name="module_s3bucket_static_assets"></a> [s3bucket\_static\_assets](#module\_s3bucket\_static\_assets) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.24/terraform-s3bucket.zip | n/a |
5556
| <a name="module_sqs_event_publisher_errors"></a> [sqs\_event\_publisher\_errors](#module\_sqs\_event\_publisher\_errors) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.24/terraform-sqs.zip | n/a |
5657
| <a name="module_sqs_mesh_download"></a> [sqs\_mesh\_download](#module\_sqs\_mesh\_download) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.24/terraform-sqs.zip | n/a |
58+
| <a name="module_sqs_pdm_poll"></a> [sqs\_pdm\_poll](#module\_sqs\_pdm\_poll) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.24/terraform-sqs.zip | n/a |
5759
| <a name="module_sqs_pdm_uploader"></a> [sqs\_pdm\_uploader](#module\_sqs\_pdm\_uploader) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.24/terraform-sqs.zip | n/a |
5860
| <a name="module_sqs_ttl"></a> [sqs\_ttl](#module\_sqs\_ttl) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.24/terraform-sqs.zip | n/a |
5961
| <a name="module_sqs_ttl_handle_expiry_errors"></a> [sqs\_ttl\_handle\_expiry\_errors](#module\_sqs\_ttl\_handle\_expiry\_errors) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.24/terraform-sqs.zip | n/a |

infrastructure/terraform/components/dl/aws_api_gateway_deployment_pdm_mock.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ resource "aws_api_gateway_deployment" "pdm_mock" {
1616
aws_api_gateway_resource.document_reference[0].id,
1717
aws_api_gateway_resource.document_reference_id[0].id,
1818
aws_api_gateway_method.create_document_reference[0].id,
19+
aws_api_gateway_method.create_document_reference[0].authorization,
1920
aws_api_gateway_method.get_document_reference[0].id,
21+
aws_api_gateway_method.get_document_reference[0].authorization,
2022
aws_api_gateway_integration.create_document_reference[0].id,
2123
aws_api_gateway_integration.get_document_reference[0].id,
2224
]))

infrastructure/terraform/components/dl/aws_api_gateway_method_create_document_reference.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ resource "aws_api_gateway_method" "create_document_reference" {
44
rest_api_id = aws_api_gateway_rest_api.pdm_mock[0].id
55
resource_id = aws_api_gateway_resource.document_reference[0].id
66
http_method = "POST"
7-
authorization = "AWS_IAM"
7+
authorization = "NONE"
88
}

infrastructure/terraform/components/dl/aws_api_gateway_method_get_document_reference.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ resource "aws_api_gateway_method" "get_document_reference" {
44
rest_api_id = aws_api_gateway_rest_api.pdm_mock[0].id
55
resource_id = aws_api_gateway_resource.document_reference_id[0].id
66
http_method = "GET"
7-
authorization = "AWS_IAM"
7+
authorization = "NONE"
88
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
resource "aws_cloudwatch_event_rule" "pdm_resource_submitted" {
2+
name = "${local.csi}-pdm-resource-submitted"
3+
description = "PDM resource submitted event rule"
4+
event_bus_name = aws_cloudwatch_event_bus.main.name
5+
6+
event_pattern = jsonencode({
7+
"detail" : {
8+
"type" : [
9+
"uk.nhs.notify.digital.letters.pdm.resource.submitted.v1"
10+
]
11+
}
12+
})
13+
}
14+
15+
resource "aws_cloudwatch_event_target" "pdm_resource_submitted_pdm_poll" {
16+
rule = aws_cloudwatch_event_rule.pdm_resource_submitted.name
17+
arn = module.sqs_pdm_poll.sqs_queue_arn
18+
event_bus_name = aws_cloudwatch_event_bus.main.name
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
resource "aws_cloudwatch_event_rule" "pdm_resource_unavailable" {
2+
name = "${local.csi}-pdm-resource-unavailable"
3+
description = "PDM resource unavailable event rule"
4+
event_bus_name = aws_cloudwatch_event_bus.main.name
5+
6+
event_pattern = jsonencode({
7+
"detail" : {
8+
"type" : [
9+
"uk.nhs.notify.digital.letters.pdm.resource.unavailable.v1"
10+
]
11+
}
12+
})
13+
}
14+
15+
resource "aws_cloudwatch_event_target" "pdm_resource_unavailable_pdm_poll" {
16+
rule = aws_cloudwatch_event_rule.pdm_resource_unavailable.name
17+
arn = module.sqs_pdm_poll.sqs_queue_arn
18+
event_bus_name = aws_cloudwatch_event_bus.main.name
19+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resource "aws_lambda_event_source_mapping" "pdm_poll_lambda" {
2+
event_source_arn = module.sqs_pdm_poll.sqs_queue_arn
3+
function_name = module.pdm_poll.function_name
4+
batch_size = var.queue_batch_size
5+
maximum_batching_window_in_seconds = var.queue_batch_window_seconds
6+
7+
function_response_types = [
8+
"ReportBatchItemFailures"
9+
]
10+
}

0 commit comments

Comments
 (0)