module "stripo_patches_service" {
  source = "git@github.com:theorchard/terraform-fargate.git//?ref=6.4.1"

  providers = {
    aws.dns = aws.dev
  }

  environment                              = var.environment
  service_name                             = "${var.service_name}-patches-service"
  aws_region                               = var.aws_region
  application_family                       = var.application_family
  service_platform_version                 = "1.4.0"
  deployment_minimum_healthy_percent       = "100"
  desired_task_count                       = 1
  minimum_capacity                         = 1
  maximum_capacity                         = 1
  task_cpu                                 = 512
  task_memory                              = 1024
  container_port                           = 8080
  health_check_grace_period_seconds        = 300
  container_start_period_seconds           = 300
  health_check_path                        = "/version"
  override_route53_zone_id                 = data.aws_route53_zone.route53_zone.id
  load_balancer_access_logs_s3_bucket_name = var.load_balancer_logs_bucket
  vpc_id                                   = module.vpc_info.vpc_id
  fargate_service_subnets                  = module.vpc_info.default_private_subnet_ids
  load_balancer_subnets                    = module.vpc_info.default_private_subnet_ids
  non_ecr_image                            = "086679231553.dkr.ecr.us-east-1.amazonaws.com/stripo/patches-service:1.175.0"
  blocking_waf_enabled                     = false
  https_listener_certificate_id            = var.https_listener_certificate_id

  environment_variables = [
    {
      Environment = "${var.environment}"
    },
    {
      APPLICATION_ENV = "${var.environment}"
    },
    {
      DD_TRACE_ANALYTICS_ENABLED = "true"
    },
    {
      DD_TRACE_APP_NAME = "${var.environment}-${var.service_name}"
    },
    {
      DD_TRACE_GLOBAL_TAGS = "env:${var.environment}-${var.service_name}"
    },
    {
      APPNAME = "patches-service"
    },
    {
      ENV = "PLUGINS"
    },
    {
      PROFILE = "PLUGINS"
    },
    {
      NODE_MEMORY = "512"
    }
  ]
}
