# Lambda function for the encoding route step
module "encoding_route_lambda" {
  source = "git@github.com:theorchard/terraform-lambda.git"

  environment              = var.environment
  lambda_name              = "asset-transcoder-encoding-route"
  use_custom_function_name = true
  custom_function_name     = "asset-transcoder-encoding-route-${var.environment}"
  lambda_description       = "Determines the media type of the given asset and branches to either the audio or image flow"

  lambda_function_environment_variables = {
    Environment                  = var.environment
    SNS_GENERAL_STATUS_TOPIC_ARN = module.sns_general_status.proxied_sns_arn
  }

  lambda_function_timeout                        = var.lambda_default_timeout
  vpc_security_group_ids                         = var.vpc_security_group_ids
  vpc_subnet_ids                                 = var.vpc_subnet_ids
  lambda_function_reserved_concurrent_executions = var.lambda_concurrent_executions
  datadog_enabled                                = var.datadog_enabled
  iam_policy_file_enabled                        = false
  iam_managed_policy_attachments = [
    aws_iam_policy.common_lambda_policy.arn,
  ]
}

