Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions infrastructure/lambda-im-alerting.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module "im-alerting-lambda" {
ALARM_HISTORY_DYNAMODB_NAME = module.alarm_state_history_table.table_name
SLACK_CHANNEL_ID = data.aws_ssm_parameter.slack_alerting_channel_id.value
SLACK_BOT_TOKEN = data.aws_ssm_parameter.slack_alerting_bot_token.value
VIRUS_SCANNER_TOPIC_ARN = local.is_production ? module.cloud_storage_security[0].proactive_notifications_topic_arn : ""
}
is_gateway_integration_needed = false
is_invoked_from_gateway = false
Expand Down
19 changes: 19 additions & 0 deletions infrastructure/virusscanner.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,22 @@ resource "aws_sns_topic_subscription" "proactive_virus_scanning_notifications" {
"scanResult" : ["Infected", "Error", "Unscannable", "Suspicious"]
})
}

resource "aws_sns_topic_subscription" "virus_scanner_im_alerting" {
count = local.is_production ? 1 : 0
protocol = "lambda"
endpoint = module.im-alerting-lambda.lambda_arn
topic_arn = module.cloud_storage_security[0].proactive_notifications_topic_arn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is throwing:

  Error: Invalid index on virusscanner.tf line 110, in resource "aws_sns_topic_subscription" "virus_scanner_im_alerting":
   110:   topic_arn = module.cloud_storage_security[0].proactive_notifications_topic_arn
      ├────────────────
      │ module.cloud_storage_security is empty tuple
  
  The given key does not identify an element in this collection value: the collection has no elements.

filter_policy = jsonencode({
"notificationType" : ["scanResult"],
"scanResult" : ["Infected", "Error", "Unscannable", "Suspicious"]
})
}

resource "aws_lambda_permission" "virus_scanner_im_alerting" {
count = local.is_production ? 1 : 0
action = "lambda:InvokeFunction"
function_name = module.im-alerting-lambda.lambda_arn
principal = "sns.amzamonaws.com"
source_arn = aws_sns_topic_subscription.virus_scanner_im_alerting[0].arn
}