File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,9 +8,11 @@ module "mns_publisher" {
88 immunisation_account_id = var. immunisation_account_id
99 is_temp = local. is_temp
1010 resource_scope = local. resource_scope
11- imms-base-path = strcontains (var. sub_environment , " pr-" ) ? " immunisation-fhir-api/FHIR/R4-${ var . sub_environment } " : " immunisation-fhir-api/FHIR/R4"
11+ imms_base_path = strcontains (var. sub_environment , " pr-" ) ? " immunisation-fhir-api/FHIR/R4-${ var . sub_environment } " : " immunisation-fhir-api/FHIR/R4"
1212 lambda_kms_encryption_key_arn = data. aws_kms_key . existing_lambda_encryption_key . arn
1313 mns_publisher_resource_name_prefix = " ${ local . resource_scope } -mns-outbound-events"
14+ secrets_manager_policy_path = " ${ local . policy_path } /secret_manager.json"
15+ account_id = data. aws_caller_identity . current . account_id
1416 pds_environment = var. pds_environment
1517 mns_environment = var. mns_environment
1618
Original file line number Diff line number Diff line change @@ -210,8 +210,8 @@ resource "aws_lambda_function" "mns_publisher_lambda" {
210210
211211data "aws_iam_policy_document" "mns_publisher_secrets_policy_document" {
212212 source_policy_documents = [
213- templatefile (" ${ local . policy_path } /secret_manager.json " , {
214- " account_id" : data.aws_caller_identity.current .account_id,
213+ templatefile (" ${ var . secrets_manager_policy_path } " , {
214+ " account_id" : var .account_id,
215215 " pds_environment" : var.pds_environment
216216 }),
217217 ]
@@ -227,7 +227,7 @@ resource "aws_iam_policy" "mns_publisher_lambda_secrets_policy" {
227227# Attach the secrets/dynamodb access policy to the Lambda role
228228resource "aws_iam_role_policy_attachment" "mns_publisher_lambda_secrets_policy_attachment" {
229229 role = aws_iam_role. mns_publisher_lambda_exec_role . name
230- policy_arn = aws_iam_policy. mns_publish_lambda_secrets_policy . arn
230+ policy_arn = aws_iam_policy. mns_publisher_lambda_secrets_policy . arn
231231}
232232
233233
Original file line number Diff line number Diff line change @@ -93,3 +93,13 @@ variable "mns_environment" {
9393variable "pds_environment" {
9494 type = string
9595}
96+
97+ variable "account_id" {
98+ type = string
99+ description = " AWS account ID used for IAM policy templating (e.g., Secrets Manager ARNs)."
100+ }
101+
102+ variable "secrets_manager_policy_path" {
103+ type = string
104+ description = " Path to the IAM policy JSON template for Secrets Manager access (e.g., ./policies/secret_manager.json)."
105+ }
You can’t perform that action at this time.
0 commit comments