module "lambda_sr_record_event_sentry_project" {
  source = "git@github.com:theorchard/terraform-sentry.git?ref=4.1.2"

  application_family = var.application_family
  environment        = var.environment
  platform           = "python"
  service_name       = var.sr_record_event_function_name
  teams              = [var.environment]
}

module "lambda_sr_record_event" {
  source = "git@github.com:theorchard/terraform-lambda.git//?ref=4.2.0"

  application_family       = var.application_family
  datadog_advanced_enabled = true
  environment              = var.environment
  lambda_name              = var.sr_record_event_function_name
  lambda_description       = "Record events related to delivery of sound recording to Facebook"
  lambda_function_timeout  = var.lambda_default_timeout
  use_container_image      = true
  vpc_id                   = var.vpc_id
  vpc_subnet_ids           = var.vpc_subnet_ids

  lambda_function_environment_variables = {
    ENVIRONMENT   = var.environment
    KAFKA_TOPIC   = var.kafka_delivery_topic
    KAFKA_BROKERS = var.kafka_brokers
    NEW_ELIGIBILITY_FLOW = var.new_eligibility_flow
  }

  lambda_function_reserved_concurrent_executions = "20"
}

module "datadog_lambda_sr_record_event_dashboards" {
  source                            = "git@github.com:theorchard/terraform-datadog.git//modules/lambda?ref=6.18.1"
  service_name                      = var.sr_record_event_function_name
  environment                       = var.environment
  lambda_invocation_monitor_enabled = false
  lambda_error_monitor_enabled      = true
  notification_endpoints            = var.notification_endpoints
  teams                             = var.teams
}
