Skip to content

Commit 44c5343

Browse files
authored
[NDR-343] Add SSM param to terraform (#549)
1 parent 141f5e1 commit 44c5343

File tree

5 files changed

+37
-1
lines changed

5 files changed

+37
-1
lines changed

infrastructure/core.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# A set of resources that do not belong to one workspace but are shared across the environment.
2+
3+
module "ssm_param_mtls_common_names" {
4+
count = local.is_sandbox ? 0 : 1
5+
source = "./modules/ssm_parameter"
6+
environment = var.environment
7+
owner = var.owner
8+
name = "mtls_common_names"
9+
type = "SecureString"
10+
description = "A list of mtls common names that will be used to determine authorisation and resources."
11+
value = "REPLACE_ME"
12+
key_id = module.pdm_encryption_key.id
13+
ignore_value_changes = true
14+
}

infrastructure/lambda-get-document-fhir.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module "get-doc-fhir-lambda" {
4242
module.pdm_dynamodb_table.dynamodb_read_policy_document,
4343
module.core_dynamodb_table.dynamodb_read_policy_document,
4444
aws_iam_policy.ssm_access_policy.policy,
45+
aws_iam_policy.mtls_access_ssm_policy.policy,
4546
module.ndr-lloyd-george-store.s3_read_policy_document,
4647
module.pdm-document-store.s3_read_policy_document,
4748
]

infrastructure/lambda-post-document-fhir.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module "post-document-references-fhir-lambda" {
99
module.core_dynamodb_table.dynamodb_write_policy_document,
1010
module.ndr-bulk-staging-store.s3_write_policy_document,
1111
module.ndr-app-config.app_config_policy,
12+
aws_iam_policy.mtls_access_ssm_policy.policy,
1213
aws_iam_policy.ssm_access_policy.policy
1314
]
1415
kms_deletion_window = var.kms_deletion_window

infrastructure/lambda-search-document-references-fhir.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ module "search-document-references-fhir-lambda" {
1313
module.core_dynamodb_table.dynamodb_write_policy_document,
1414
module.ndr-lloyd-george-store.s3_read_policy_document,
1515
module.ndr-document-store.s3_read_policy_document,
16-
module.ndr-app-config.app_config_policy
16+
module.ndr-app-config.app_config_policy,
17+
aws_iam_policy.mtls_access_ssm_policy.policy,
18+
aws_iam_policy.ssm_access_policy.policy
1719
]
1820
kms_deletion_window = var.kms_deletion_window
1921
rest_api_id = aws_api_gateway_rest_api.ndr_doc_store_api.id

infrastructure/policies.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,21 @@ resource "aws_iam_policy" "transfer_family_kill_switch" {
109109
]
110110
})
111111
}
112+
113+
resource "aws_iam_policy" "mtls_access_ssm_policy" {
114+
name = "${terraform.workspace}_mtls_ssm_parameters"
115+
policy = jsonencode({
116+
Version = "2012-10-17",
117+
Statement = [
118+
{
119+
Effect = "Allow",
120+
Action = [
121+
"kms:Decrypt",
122+
],
123+
Resource = [
124+
module.pdm_encryption_key.kms_arn
125+
]
126+
}
127+
]
128+
})
129+
}

0 commit comments

Comments
 (0)