module "ar-to-ddb-sync" {
    source = "git@github.com:theorchard/terraform-lambda.git"

    environment                      = var.environment
    use_custom_function_name         = true
    custom_function_name             = "lambda-ar-to-ddb-sync-${var.environment}"
    lambda_name                      = "ar-to-ddb-sync"
    lambda_description               = "The new delivery ar-to-ddb-sync script."
    lambda_function_memory_size      = var.lambda_memory_size
    cloudwatch_event_enabled         = var.cloudwatch_event_enabled
    cloudwatch_event_schedule        = var.cloudwatch_event_schedule
    datadog_function_destination_arn = var.datadog_function_destination_arn

    lambda_function_environment_variables = {
        Environment                  = var.environment
        LOGGER_DSN                   = var.logger_dsn
        AR_MYSQL_DATABASE            = var.ar_mysql_database
        AR_MYSQL_HOST                = var.ar_mysql_host
        AR_MYSQL_PORT                = var.ar_mysql_port
        AR_MYSQL_USER                = var.ar_mysql_user
        DDB_WRITE_MAX_ATTEMPTS       = var.ddb_write_max_attempts
        ELASTICSEARCH_USE_AUTH       = var.elasticsearch_use_auth
        ORDERS_DDB_TABLE             = var.orders_ddb_table
        ORDERS_S3_BUCKET             = var.orders_s3_bucket
        ORDER_ENCODER_ID_LIST        = var.order_encoder_id_list
    }

    lambda_function_timeout                        = var.lambda_default_timeout
    vpc_security_group_ids                         = var.vpc_security_group_ids
    iam_policy_file_enabled                        = true
    vpc_subnet_ids                                 = var.vpc_subnet_ids
    iam_policy_file_location                       = var.iam_policy_file_location
    lambda_function_reserved_concurrent_executions = var.lambda_concurrent_executions

}
