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

  providers = {
    aws.dns = aws
  }

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

  rds_master_username = "chef_admin"
  rds_master_password = "s0mePass!changme"

  rds_cluster_instance_class                = var.rds_instance_type
  rds_cluster_instance_count                = var.rds_cluster_instance_count
  rds_db_cluster_parameter_group_name       = "default.aurora-postgresql13"
  rds_cluster_instance_parameter_group_name = "default.aurora-postgresql13"
  rds_engine                                = "aurora-postgresql"
  rds_engine_version                        = "13.18" # Chef Server is currently not compatible with later versions of Postgres
  rds_db_subnet_group_name                  = var.rds_db_subnet_group_name
  rds_performance_insights_enabled          = false
  enabled_cloudwatch_logs_exports           = ["postgresql"]

  custom_kms_key_enabled = false

  vpc_id          = module.vpc_info.vpc_id
  route53_zone_id = data.aws_route53_zone.route53_zone.zone_id
}
