module "upload_audit_logs_to_s3_lambda" {
  source = "git@github.com:theorchard/terraform-lambda.git//"

  environment                            = "${var.environment}"
  lambda_name                            = "upload-audit-logs-to-s3"
  use_custom_function_name               = true
  custom_function_name                   = "${var.custom_function_name}"
  lambda_description                     = "This Lambda uploads logs to S3 from lambda-logging repo"
  lambda_function_package_path           = "lambda.zip"
  lambda_function_timeout                = "300"
  event_source_mapping_batch_size        = "5"
  event_source_mapping_enabled           = true
  event_source_mapping_resource_type     = "kinesis"
  event_source_mapping_starting_position = "LATEST"
  event_source_mapping_stream_name       = "${var.environment}-maxwell-cloudsearch"
  iam_policy_file_enabled                = true
  iam_policy_file_location               = "${var.iam_policy_file_location}"
  vpc_security_group_ids                 = "${var.vpc_security_group_ids}"
  vpc_subnet_ids                         = "${var.vpc_subnet_ids}"
  lambda_function_reserved_concurrent_executions  = "${var.lambda_function_reserved_concurrent_executions}"
  lambda_function_environment_variables  = {
    Environment        = "${var.environment}"
    AWS_S3_BUCKET_NAME = "${var.environment}-orchard-logging"
    LOGGER_DSN         = "${var.LOGGER_DSN}"
    SENTRY_DSN         = "${var.SENTRY_DSN}"
  }
}
