11module "mns-notification-lambda" {
2- # count = local.is_sandbox ? 0 : 1
2+ count = 1
33 source = " ./modules/lambda"
44 name = " MNSNotificationLambda"
55 handler = " handlers.mns_notification_handler.lambda_handler"
66 iam_role_policy_documents = [
7- module . sqs-mns-notification-queue . sqs_read_policy_document ,
8- module . sqs-mns-notification-queue . sqs_write_policy_document ,
7+ module . sqs-mns-notification-queue [ 0 ] . sqs_read_policy_document ,
8+ module . sqs-mns-notification-queue [ 0 ] . sqs_write_policy_document ,
99 module . lloyd_george_reference_dynamodb_table . dynamodb_write_policy_document ,
1010 module . lloyd_george_reference_dynamodb_table . dynamodb_read_policy_document ,
1111 aws_iam_policy . ssm_access_policy . policy ,
1212 module . ndr-app-config . app_config_policy ,
13- aws_iam_policy . kms_mns_lambda_access . policy ,
13+ aws_iam_policy . kms_mns_lambda_access [ 0 ] . policy ,
1414 ]
1515 rest_api_id = null
1616 api_execution_arn = null
@@ -29,30 +29,30 @@ module "mns-notification-lambda" {
2929}
3030
3131resource "aws_lambda_event_source_mapping" "mns_notification_lambda" {
32- # count = local.is_sandbox ? 0 : 1
32+ count = 1
3333 event_source_arn = module. sqs-mns-notification-queue . endpoint
3434 function_name = module. mns-notification-lambda . lambda_arn
3535}
3636
3737module "mns-notification-alarm" {
38- count = local . is_sandbox ? 0 : 1
38+ count = 1
3939 source = " ./modules/lambda_alarms"
4040 lambda_function_name = module. mns-notification-lambda . function_name
4141 lambda_timeout = module. mns-notification-lambda . timeout
4242 lambda_name = " mns_notification_handler"
4343 namespace = " AWS/Lambda"
44- alarm_actions = [module . mns-notification-alarm-topic . arn ]
45- ok_actions = [module . mns-notification-alarm-topic . arn ]
44+ alarm_actions = [module . mns-notification-alarm-topic [ 0 ] . arn ]
45+ ok_actions = [module . mns-notification-alarm-topic [ 0 ] . arn ]
4646}
4747
4848module "mns-notification-alarm-topic" {
49- # count = local.is_sandbox ? 0 : 1
49+ count = 1
5050 source = " ./modules/sns"
5151 sns_encryption_key_id = module. sns_encryption_key . id
5252 current_account_id = data. aws_caller_identity . current . account_id
5353 topic_name = " mns-notification-topic"
5454 topic_protocol = " lambda"
55- topic_endpoint = module. mns-notification-lambda . lambda_arn
55+ topic_endpoint = module. mns-notification-lambda [ 0 ] . lambda_arn
5656 delivery_policy = jsonencode ({
5757 " Version" : " 2012-10-17" ,
5858 " Statement" : [
@@ -76,7 +76,7 @@ module "mns-notification-alarm-topic" {
7676}
7777
7878resource "aws_iam_policy" "kms_mns_lambda_access" {
79- # count = local.is_sandbox ? 0 : 1
79+ count = 1
8080
8181 name = " ${ terraform . workspace } _mns_notification_lambda_access_policy"
8282 description = " KMS policy to allow lambda to read and write MNS SQS messages"
@@ -90,7 +90,7 @@ resource "aws_iam_policy" "kms_mns_lambda_access" {
9090 " kms:GenerateDataKey"
9191 ]
9292 Effect = " Allow"
93- Resource = module.mns_encryption_key.kms_arn
93+ Resource = module.mns_encryption_key[ 0 ] .kms_arn
9494 },
9595 ]
9696 })
0 commit comments