module "hot_updater_server_rds" {
  source = "git@github.com:theorchard/terraform-rds.git//?ref=6.6.0"

  providers = {
    aws.dns = aws
  }

  application_family = var.application_family
  environment        = var.environment
  service_name       = var.service_name

  rds_cluster_instance_class                  = "db.t4g.medium"
  rds_cluster_instance_count                  = "1"
  rds_engine                                  = "aurora-postgresql"
  rds_engine_version                          = "16.11"
  rds_master_username                         = "hot_updater_server"
  rds_master_password                         = "s0mePass!chang3me"
  rds_availability_zones                      = ["us-east-1a", "us-east-1c"]
  enabled_cloudwatch_logs_exports             = ["postgresql"]
  rds_db_cluster_parameter_group_family       = "aurora-postgresql16"
  rds_cluster_instance_parameter_group_family = "aurora-postgresql16"
  route53_zone_id                             = data.aws_route53_zone.route53_zone.zone_id
  vpc_id                                      = module.vpc_info.vpc_id
  rds_db_subnet_ids                           = module.vpc_info.default_private_subnet_ids

  rds_db_cluster_parameters = [
    {
      name         = "rds.force_ssl"
      value        = "1"
      apply_method = "immediate"
    }
  ]
}

module "hot_updater_server_rds_dashboard" {
  source = "git@github.com:theorchard/terraform-datadog.git//modules/rds?ref=6.13.4"

  application_family = var.application_family
  environment        = var.environment
  service_name       = var.service_name

  notification_endpoints            = var.notification_endpoints
  escalation_notification_endpoints = var.escalation_notification_endpoints
}
