Skip to content

Commit 242e7c0

Browse files
committed
CCM-12616: Fix mesh-poll SSM parameters
1 parent 02e1566 commit 242e7c0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

infrastructure/terraform/components/dl/locals.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ locals {
55
apim_api_key_ssm_parameter_name = "/${var.component}/${var.environment}/apim/api_key"
66
apim_private_key_ssm_parameter_name = "/${var.component}/${var.environment}/apim/private_key"
77
apim_keystore_s3_bucket = "nhs-${var.aws_account_id}-${var.region}-${var.environment}-${var.component}-static-assets"
8+
ssm_mesh_prefix = "/${var.component}/${var.environment}/mesh"
89
root_domain_name = "${var.environment}.${local.acct.route53_zone_names["digital-letters"]}"
910
root_domain_id = local.acct.route53_zone_ids["digital-letters"]
1011
ttl_shard_count = 3

infrastructure/terraform/components/dl/module_lambda_mesh_poll.tf

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module "mesh_poll" {
3838
log_subscription_role_arn = local.acct.log_subscription_role_arn
3939

4040
lambda_env_vars = {
41-
SSM_PREFIX = "/dl/${var.environment}/mesh"
41+
SSM_PREFIX = "${local.ssm_mesh_prefix}"
4242
MAXIMUM_RUNTIME_MILLISECONDS = "240000" # 4 minutes (Lambda has 5 min timeout)
4343
ENVIRONMENT = var.environment
4444
EVENT_PUBLISHER_EVENT_BUS_ARN = aws_cloudwatch_event_bus.main.arn
@@ -134,4 +134,17 @@ data "aws_iam_policy_document" "mesh_poll_lambda" {
134134
module.sqs_event_publisher_errors.sqs_queue_arn,
135135
]
136136
}
137+
138+
statement {
139+
sid = "SSMPermissions"
140+
effect = "Allow"
141+
142+
actions = [
143+
"ssm:GetParametersByPath",
144+
]
145+
146+
resources = [
147+
"arn:aws:ssm:${var.region}:${var.aws_account_id}:parameter/${local.ssm_mesh_prefix}/*"
148+
]
149+
}
137150
}

0 commit comments

Comments
 (0)