locals {
  delete_product_lambda_name = "${var.service_name}-delete-product"
  application_family = "product-builder"
}

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

  environment        = var.environment
  application_family = var.application_family
  lambda_name        = local.delete_product_lambda_name

  lambda_description      = "Hard deletes a product by UPC."
  lambda_function_timeout = "900"
  lambda_function_memory_size = 256
  use_container_image     = true
  vpc_enabled             = true
  vpc_id                  = var.vpc_id
  vpc_subnet_ids          = var.vpc_subnet_ids

  datadog_enabled          = true
  datadog_advanced_enabled = true
  lambda_function_environment_variables = {
    ENVIRONMENT            = var.environment
  }
}

module "datadog_lambda_content_delete_product" {
  source = "git@github.com:theorchard/terraform-datadog.git//modules/lambda?ref=6.13.9"

  environment                       = var.environment
  service_name                      = local.delete_product_lambda_name
  notification_endpoints            = var.notification_endpoints
  escalation_notification_endpoints = var.notification_endpoints
}

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

  environment        = var.environment
  service_name       = local.delete_product_lambda_name
  application_family = local.application_family
}

module "m2m_secrets" {
  source = "git@github.com:theorchard/terraform-secrets-manager.git//modules/auth0m2m?ref=1.6.1"

  environment                         = var.environment
  service_name                        = local.delete_product_lambda_name
  application_family                  = local.application_family
}
