Skip to content

Commit 937901f

Browse files
Merge branch 'main' into PRMT-439
2 parents 8638ef7 + 2af48a9 commit 937901f

Some content is hidden

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

42 files changed

+1335
-304
lines changed

.github/workflows/terraform-deploy-feature-to-sandbox.yml

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# .github/workflows/terraform-dev
2-
name: 'Deploy Feature Branch to Sandbox'
2+
name: "Deploy Feature Branch to Sandbox"
33

44
on:
55
workflow_dispatch:
66
inputs:
77
buildBranch:
8-
description: 'Feature branch to push to sandbox.'
8+
description: "Feature branch to push to sandbox."
99
required: true
10-
type: 'string'
10+
type: "string"
1111
sandboxWorkspace:
12-
description: 'Which Sandbox to push to.'
12+
description: "Which Sandbox to push to."
1313
required: true
14-
type: 'string'
14+
type: "string"
1515
environment:
16-
default: 'development'
17-
description: 'Which environment should this run against'
16+
default: "development"
17+
description: "Which environment should this run against"
1818
required: true
19-
type: 'string'
19+
type: "string"
2020

2121
permissions:
2222
pull-requests: write
@@ -29,11 +29,10 @@ jobs:
2929
environment: ${{ github.event.inputs.environment }}
3030

3131
steps:
32-
# Checkout the repository to the GitHub Actions runner
33-
- name: Checkout
32+
- name: Checkout Base
3433
uses: actions/checkout@v4
3534
with:
36-
ref: ${{ github.event.inputs.buildBranch}}
35+
ref: main
3736

3837
- name: Configure AWS Credentials
3938
uses: aws-actions/configure-aws-credentials@v4
@@ -53,23 +52,51 @@ jobs:
5352
terraform_version: 1.11.4
5453
terraform_wrapper: false
5554

56-
- name: Terraform Init
57-
id: init
55+
- name: Terraform Init Base
56+
id: base_init
5857
run: terraform init -backend-config=backend.conf
5958
working-directory: ./infrastructure
6059
shell: bash
6160

62-
- name: Terraform Set Workspace
63-
id: workspace
61+
- name: Terraform Set Workspace Base
62+
id: base_workspace
6463
run: terraform workspace select -or-create ${{ github.event.inputs.sandboxWorkspace}}
6564
working-directory: ./infrastructure
6665
shell: bash
6766

68-
# Checks that all Terraform configuration files adhere to a canonical format
67+
- name: Terraform Plan Base
68+
id: base_plan
69+
run: |
70+
terraform plan -input=false -no-color -var-file="${{vars.TF_VARS_FILE}}" -out tf-base.plan
71+
working-directory: ./infrastructure
72+
shell: bash
73+
74+
- name: Terraform Apply Base
75+
run: terraform apply -auto-approve -input=false tf-base.plan
76+
working-directory: ./infrastructure
77+
78+
- name: Checkout Branch
79+
uses: actions/checkout@v4
80+
with:
81+
ref: ${{ github.event.inputs.buildBranch}}
82+
83+
# Checks that all Terraform configuration files adhere to a canonical format.
6984
- name: Terraform Format
7085
run: terraform fmt -check
7186
working-directory: ./infrastructure
7287

88+
- name: Terraform Init
89+
id: init
90+
run: terraform init -backend-config=backend.conf
91+
working-directory: ./infrastructure
92+
shell: bash
93+
94+
- name: Terraform Set Workspace
95+
id: workspace
96+
run: terraform workspace select ${{ github.event.inputs.sandboxWorkspace}}
97+
working-directory: ./infrastructure
98+
shell: bash
99+
73100
- name: Terraform Plan
74101
id: plan
75102
run: |

.husky/pre-commit

Lines changed: 0 additions & 14 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: terraform-docs
5+
name: terraform-docs
6+
entry: python scripts/run_terraform_docs.py
7+
language: python
8+
pass_filenames: false

.terraform-docs.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
formatter: "markdown table"
2+
version: "0.20"
3+
4+
header-from: main.tf
5+
footer-from: ""
6+
7+
recursive:
8+
enabled: false
9+
path: ""
10+
11+
sections:
12+
hide: []
13+
show: []
14+
15+
content: |-
16+
{{ .Requirements }}
17+
{{ .Resources }}
18+
{{ .Inputs }}
19+
{{ .Outputs }}
20+
21+
output:
22+
file: README.md
23+
mode: inject
24+
template: |-
25+
<!-- BEGIN_TF_DOCS -->
26+
{{ .Content }}
27+
<!-- END_TF_DOCS -->
28+
29+
output-values:
30+
enabled: false
31+
from: ""
32+
33+
sort:
34+
enabled: true
35+
by: name
36+
37+
settings:
38+
anchor: true
39+
color: true
40+
default: true
41+
description: true
42+
escape: true
43+
hide-empty: false
44+
html: true
45+
indent: 2
46+
lockfile: true
47+
read-comments: true
48+
required: true
49+
sensitive: true
50+
type: true

infrastructure/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
| <a name="module_access-audit-gateway"></a> [access-audit-gateway](#module\_access-audit-gateway) | ./modules/gateway | n/a |
2121
| <a name="module_access-audit-lambda"></a> [access-audit-lambda](#module\_access-audit-lambda) | ./modules/lambda | n/a |
2222
| <a name="module_access_audit_dynamodb_table"></a> [access\_audit\_dynamodb\_table](#module\_access\_audit\_dynamodb\_table) | ./modules/dynamo_db | n/a |
23+
| <a name="module_alarm_state_history_table"></a> [alarm\_state\_history\_table](#module\_alarm\_state\_history\_table) | ./modules/dynamo_db | n/a |
2324
| <a name="module_api_endpoint_url_ssm_parameter"></a> [api\_endpoint\_url\_ssm\_parameter](#module\_api\_endpoint\_url\_ssm\_parameter) | ./modules/ssm_parameter | n/a |
2425
| <a name="module_auth_session_dynamodb_table"></a> [auth\_session\_dynamodb\_table](#module\_auth\_session\_dynamodb\_table) | ./modules/dynamo_db | n/a |
2526
| <a name="module_auth_state_dynamodb_table"></a> [auth\_state\_dynamodb\_table](#module\_auth\_state\_dynamodb\_table) | ./modules/dynamo_db | n/a |
@@ -88,6 +89,7 @@
8889
| <a name="module_get-report-by-ods-alarm-topic"></a> [get-report-by-ods-alarm-topic](#module\_get-report-by-ods-alarm-topic) | ./modules/sns | n/a |
8990
| <a name="module_get-report-by-ods-gateway"></a> [get-report-by-ods-gateway](#module\_get-report-by-ods-gateway) | ./modules/gateway | n/a |
9091
| <a name="module_get-report-by-ods-lambda"></a> [get-report-by-ods-lambda](#module\_get-report-by-ods-lambda) | ./modules/lambda | n/a |
92+
| <a name="module_im-alerting-lambda"></a> [im-alerting-lambda](#module\_im-alerting-lambda) | ./modules/lambda | n/a |
9193
| <a name="module_lambda-layer-core"></a> [lambda-layer-core](#module\_lambda-layer-core) | ./modules/lambda_layers | n/a |
9294
| <a name="module_lambda-layer-data"></a> [lambda-layer-data](#module\_lambda-layer-data) | ./modules/lambda_layers | n/a |
9395
| <a name="module_lloyd-george-stitch-gateway"></a> [lloyd-george-stitch-gateway](#module\_lloyd-george-stitch-gateway) | ./modules/gateway | n/a |
@@ -243,6 +245,8 @@
243245
| [aws_cognito_identity_pool_roles_attachment.cloudwatch_rum](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cognito_identity_pool_roles_attachment) | resource |
244246
| [aws_default_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) | resource |
245247
| [aws_default_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) | resource |
248+
| [aws_iam_policy.alerting_lambda_alarms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
249+
| [aws_iam_policy.alerting_lambda_tags](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
246250
| [aws_iam_policy.cloudwatch_log_query_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
247251
| [aws_iam_policy.cloudwatch_rum_cognito_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
248252
| [aws_iam_policy.copy_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
@@ -364,16 +368,21 @@
364368
| [aws_ssm_parameter.cloud_security_admin_email](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
365369
| [aws_ssm_parameter.cloud_security_notification_email_list](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
366370
| [aws_ssm_parameter.end_user_ods_code](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
371+
| [aws_ssm_parameter.im_alerting_confluence_url](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
367372
| [aws_ssm_parameter.mns_lambda_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
373+
| [aws_ssm_parameter.slack_alerting_bot_token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
374+
| [aws_ssm_parameter.slack_alerting_channel_id](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
368375
| [aws_ssm_parameter.splunk_trusted_principal](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
369376
| [aws_ssm_parameter.target_backup_vault_arn](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
377+
| [aws_ssm_parameter.teams_alerting_webhook_url](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
370378
| [aws_ssm_parameter.virus_scanning_subnet_cidr_range](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
371379

372380
## Inputs
373381

374382
| Name | Description | Type | Default | Required |
375383
|------|-------------|------|---------|:--------:|
376384
| <a name="input_access_audit_dynamodb_table_name"></a> [access\_audit\_dynamodb\_table\_name](#input\_access\_audit\_dynamodb\_table\_name) | The name of the dynamodb table to store the audit of access to deceased patient records | `string` | `"AccessAudit"` | no |
385+
| <a name="input_alarm_state_history_table_name"></a> [alarm\_state\_history\_table\_name](#input\_alarm\_state\_history\_table\_name) | The name of the dynamodb table to store the history of recent alarms that have been triggered. | `string` | `"AlarmStateHistory"` | no |
377386
| <a name="input_apim_environment"></a> [apim\_environment](#input\_apim\_environment) | n/a | `any` | n/a | yes |
378387
| <a name="input_auth_session_dynamodb_table_name"></a> [auth\_session\_dynamodb\_table\_name](#input\_auth\_session\_dynamodb\_table\_name) | The name of the dynamodb table to store user login sessions | `string` | `"AuthSessionReferenceMetadata"` | no |
379388
| <a name="input_auth_state_dynamodb_table_name"></a> [auth\_state\_dynamodb\_table\_name](#input\_auth\_state\_dynamodb\_table\_name) | The name of the dynamodb table to store the state values (for CIS2 authorisation) | `string` | `"AuthStateReferenceMetadata"` | no |

infrastructure/api.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ resource "aws_api_gateway_deployment" "ndr_api_deploy" {
4747
module.access-audit-lambda,
4848
module.back-channel-logout-gateway,
4949
module.back_channel_logout_lambda,
50-
module.document_reference_gateway,
5150
module.create-doc-ref-lambda,
5251
module.create_document_reference_gateway,
5352
module.create-token-gateway,
@@ -58,6 +57,7 @@ resource "aws_api_gateway_deployment" "ndr_api_deploy" {
5857
module.document-manifest-job-lambda,
5958
module.feature-flags-gateway,
6059
module.feature-flags-lambda,
60+
module.fhir_document_reference_gateway,
6161
module.get-doc-fhir-lambda,
6262
module.get-report-by-ods-gateway,
6363
module.get-report-by-ods-lambda,

infrastructure/dynamo_db.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,3 +483,30 @@ module "pdm_dynamodb_table" {
483483
environment = var.environment
484484
owner = var.owner
485485
}
486+
487+
488+
module "alarm_state_history_table" {
489+
source = "./modules/dynamo_db"
490+
table_name = var.alarm_state_history_table_name
491+
hash_key = "AlarmNameMetric"
492+
sort_key = "TimeCreated"
493+
deletion_protection_enabled = local.is_production
494+
point_in_time_recovery_enabled = false
495+
stream_enabled = false
496+
ttl_enabled = true
497+
ttl_attribute_name = "TimeToExist"
498+
499+
attributes = [
500+
{
501+
name = "AlarmNameMetric",
502+
type = "S"
503+
},
504+
{
505+
name = "TimeCreated"
506+
type = "N"
507+
}
508+
]
509+
510+
environment = var.environment
511+
owner = var.owner
512+
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
module "document_reference_gateway" {
1+
module "fhir_document_reference_gateway" {
2+
count = local.is_production ? 0 : 1
23
source = "./modules/gateway"
34
api_gateway_id = aws_api_gateway_rest_api.ndr_doc_store_api.id
45
parent_id = aws_api_gateway_rest_api.ndr_doc_store_api.root_resource_id
56
http_methods = ["POST", "GET"]
67
authorization = "NONE"
78
api_key_required = true
8-
gateway_path = "DocumentReference"
9+
gateway_path = "FhirDocumentReference"
910
require_credentials = true
1011
}

infrastructure/iam.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ data "aws_iam_policy_document" "assume_role_policy_for_create_lambda" {
2525
module.create-doc-ref-lambda.lambda_execution_role_arn,
2626
local.is_production ? null : module.post-document-references-fhir-lambda[0].lambda_execution_role_arn
2727
])
28-
2928
}
3029
}
3130
}

0 commit comments

Comments
 (0)