<commit_before>module "window_generator_lambda" {
  source = "git::https://github.com/wellcometrust/terraform.git//lambda?ref=v1.0.5"

  name = "sierra_${var.resource_type}_window_generator_${var.resource_type}"

  s3_key      = "lambdas/sierra_adapter/sierra_window_generator.zip"
  module_name = "sierra_window_generator"

  description     = "Generate windows of a specified length and push them to SNS"
  alarm_topic_arn = "${var.lambda_error_alarm_arn}"
  timeout         = 10

  environment_variables = {
    "TOPIC_ARN"             = "${module.windows_topic.arn}"
    "WINDOW_LENGTH_MINUTES" = "${var.window_length_minutes}"
  }
}

module "trigger_sierra_window_generator_lambda" {
  source                  = "git::https://github.com/wellcometrust/terraform.git//lambda/trigger_cloudwatch?ref=v1.0.0"
  lambda_function_name    = "${module.window_generator_lambda.function_name}"
  lambda_function_arn     = "${module.window_generator_lambda.arn}"
  cloudwatch_trigger_arn  = "${aws_cloudwatch_event_rule.window_generator_rule.arn}"
  cloudwatch_trigger_name = "${aws_cloudwatch_event_rule.window_generator_rule.id}"
}

module "dynamo_to_sns" {
  source = "git::https://github.com/wellcometrust/platform.git//shared_infra/dynamo_to_sns"

  name           = "sierra_dynamo_to_sns_${var.resource_type}"
  src_stream_arn = "${aws_dynamodb_table.sierra_table.stream_arn}"<commit_msg>Reduce repetition. Reduce repetition.<commit_after>module "window_generator_lambda" {
  source = "git::https://github.com/wellcometrust/terraform.git//lambda?ref=v1.0.5"

  name = "sierra_${var.resource_type}_window_generator"

  s3_key      = "lambdas/sierra_adapter/sierra_window_generator.zip"
  module_name = "sierra_window_generator"

  description     = "Generate windows of a specified length and push them to SNS"
  alarm_topic_arn = "${var.lambda_error_alarm_arn}"
  timeout         = 10

  environment_variables = {
    "TOPIC_ARN"             = "${module.windows_topic.arn}"
    "WINDOW_LENGTH_MINUTES" = "${var.window_length_minutes}"
  }
}

module "trigger_sierra_window_generator_lambda" {
  source                  = "git::https://github.com/wellcometrust/terraform.git//lambda/trigger_cloudwatch?ref=v1.0.0"
  lambda_function_name    = "${module.window_generator_lambda.function_name}"
  lambda_function_arn     = "${module.window_generator_lambda.arn}"
  cloudwatch_trigger_arn  = "${aws_cloudwatch_event_rule.window_generator_rule.arn}"
  cloudwatch_trigger_name = "${aws_cloudwatch_event_rule.window_generator_rule.id}"
}

module "dynamo_to_sns" {
  source = "git::https://github.com/wellcometrust/platform.git//shared_infra/dynamo_to_sns"

  name           = "sierra_dynamo_to_sns_${var.resource_type}"
  src_stream_arn = "${aws_dynamodb_table.sierra_table.stream_arn}"
{'fraction_non_alphanumeric': 0.11891891891891893, 'fraction_numerical': 0.006486486486486486, 'mean_word_length': 4.771309771309771, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2484438', 'n_tokens_mistral': 968, 'n_tokens_neox': 947, 'n_words': 104}