resource "aws_db_instance" "del-rds-db-02" {
  #checkov:skip=CKV2_AWS_30: Ensure Postgres RDS as aws_db_instance has Query Logging enabled
  #checkov:skip=CKV_AWS_226: Ensure DB instance gets all minor upgrades automatically
  #checkov:skip=CKV_AWS_161: Ensure RDS database has IAM authentication enabled
  allocated_storage           = 1200
  auto_minor_version_upgrade  = false
  availability_zone           = "eu-central-1a"
  backup_retention_period     = 7
  backup_target               = "region"
  backup_window               = "07:00-07:30"
  ca_cert_identifier          = "rds-ca-rsa2048-g1"
  character_set_name          = null
  copy_tags_to_snapshot       = true
  custom_iam_instance_profile = null
  customer_owned_ip_enabled   = false
  db_name                     = "delivery"
  db_subnet_group_name        = "del-p2-xrds-sng"
  dedicated_log_volume        = false
  delete_automated_backups    = true
  deletion_protection         = true
  domain                      = null
  domain_auth_secret_arn      = null
  domain_fqdn                 = null
  domain_iam_role_name        = null
  domain_ou                   = null
  enabled_cloudwatch_logs_exports = [
    "postgresql",
    "upgrade",
  ]
  engine                              = "postgres"
  engine_lifecycle_support            = "open-source-rds-extended-support"
  engine_version                      = "18.3"
  iam_database_authentication_enabled = false
  identifier                          = "del-rds-db-02"
  identifier_prefix                   = null
  instance_class                      = "db.m6g.2xlarge"
  iops                                = 3000
  kms_key_id                          = "arn:aws:kms:eu-central-1:023180329437:key/7fcf7089-a08e-4de9-8177-1a3026ed3a1c"
  license_model                       = "postgresql-license"
  maintenance_window                  = "sun:08:00-sun:08:30"
  max_allocated_storage               = 1600
  monitoring_interval                 = 60
  monitoring_role_arn                 = "arn:aws:iam::023180329437:role/rds-monitoring-role"
  multi_az                            = true
  nchar_character_set_name            = null
  network_type                        = "IPV4"
  parameter_group_name                = "del-rds-prod-config-pg18"
  #performance_insights_enabled          = true
  #performance_insights_kms_key_id       = "arn:aws:kms:eu-central-1:023180329437:key/7fcf7089-a08e-4de9-8177-1a3026ed3a1c"
  #performance_insights_retention_period = 7
  port                        = 5432
  publicly_accessible         = false
  replica_mode                = null
  replicate_source_db         = null
  skip_final_snapshot         = true
  storage_encrypted           = true
  storage_throughput          = 0
  storage_type                = "io1"
  apply_immediately           = true
  allow_major_version_upgrade = true
  tags = {
    "SSS"                      = "IGNORE"
    "aws-migration-project-id" = "MPE22602"
    "map-dba"                  = "d-server-03ir9bbljmr9p8"
    "map-migrated"             = "d-server-03ir9bbljmr9p8"
    "workload-type"            = "production"
  }
  tags_all = {
    "SSS"                      = "IGNORE"
    "aws-migration-project-id" = "MPE22602"
    "map-dba"                  = "d-server-03ir9bbljmr9p8"
    "map-migrated"             = "d-server-03ir9bbljmr9p8"
    "workload-type"            = "production"
  }
  timezone = null
  username = "master_rds"
  vpc_security_group_ids = [
    "sg-b1daa5da",
  ]
}

resource "aws_db_instance" "mlib-rds-prod" {
  #checkov:skip=CKV2_AWS_30: Ensure Postgres RDS as aws_db_instance has Query Logging enabled
  #checkov:skip=CKV_AWS_226: Ensure DB instance gets all minor upgrades automatically
  #checkov:skip=CKV_AWS_161: Ensure RDS database has IAM authentication enabled
  allocated_storage           = 100
  auto_minor_version_upgrade  = false
  availability_zone           = "eu-central-1a"
  backup_retention_period     = 7
  backup_target               = "region"
  backup_window               = "07:00-07:30"
  ca_cert_identifier          = "rds-ca-rsa2048-g1"
  character_set_name          = null
  copy_tags_to_snapshot       = true
  custom_iam_instance_profile = null
  customer_owned_ip_enabled   = false
  db_name                     = "media_library"
  db_subnet_group_name        = "del-p2-xrds-sng"
  dedicated_log_volume        = false
  delete_automated_backups    = true
  deletion_protection         = true
  domain                      = null
  domain_auth_secret_arn      = null
  domain_fqdn                 = null
  domain_iam_role_name        = null
  domain_ou                   = null
  enabled_cloudwatch_logs_exports = [
    "postgresql",
    "upgrade",
  ]
  engine                              = "postgres"
  engine_lifecycle_support            = "open-source-rds-extended-support"
  engine_version                      = "18.3"
  iam_database_authentication_enabled = false
  identifier                          = "mlib-rds-prod"
  identifier_prefix                   = null
  instance_class                      = "db.m6g.large"
  iops                                = 3000
  kms_key_id                          = "arn:aws:kms:eu-central-1:023180329437:key/7fcf7089-a08e-4de9-8177-1a3026ed3a1c"
  license_model                       = "postgresql-license"
  maintenance_window                  = "sun:08:00-sun:08:30"
  max_allocated_storage               = 130
  monitoring_interval                 = 60
  monitoring_role_arn                 = "arn:aws:iam::023180329437:role/rds-monitoring-role"
  multi_az                            = true
  nchar_character_set_name            = null
  network_type                        = "IPV4"
  parameter_group_name                = "mlib-prod-pg18"
  #    performance_insights_enabled          = true
  #    performance_insights_kms_key_id       = "arn:aws:kms:eu-central-1:023180329437:key/7fcf7089-a08e-4de9-8177-1a3026ed3a1c"
  #    performance_insights_retention_period = 7
  port                        = 5432
  publicly_accessible         = false
  replica_mode                = null
  replicate_source_db         = null
  skip_final_snapshot         = true
  storage_encrypted           = true
  storage_throughput          = 125
  storage_type                = "gp3"
  apply_immediately           = true
  allow_major_version_upgrade = true
  tags = {
    "Business-unit"            = "SME AOMA Core"
    "Environment"              = "prod"
    "Owner"                    = "Nathaniel Lovett"
    "Project-Code"             = "SME-2000-0306B"
    "Project-Name"             = "Delivery-Prod"
    "SSS"                      = "IGNORE"
    "aws-migration-project-id" = "MPE22602"
    "map-dba"                  = "d-server-03ir9bbljmr9p8"
    "map-migrated"             = "d-server-03ir9bbljmr9p8"
  }
  tags_all = {
    "Business-unit"            = "SME AOMA Core"
    "Environment"              = "prod"
    "Owner"                    = "Nathaniel Lovett"
    "Project-Code"             = "SME-2000-0306B"
    "Project-Name"             = "Delivery-Prod"
    "SSS"                      = "IGNORE"
    "aws-migration-project-id" = "MPE22602"
    "map-dba"                  = "d-server-03ir9bbljmr9p8"
    "map-migrated"             = "d-server-03ir9bbljmr9p8"
  }
  timezone = null
  username = "master_rds"
  vpc_security_group_ids = [
    "sg-055ad5a266f4ef1c0",
  ]
}

