resource "aws_db_instance" "amp-digital-archive-dev-rds-01" {
  #checkov:skip=CKV2_AWS_30: Ensure Postgres RDS as aws_db_instance has Query Logging enabled
  #checkov:skip=CKV_AWS_161: Ensure RDS database has IAM authentication enabled
  #checkov:skip=CKV_AWS_157: Ensure that RDS instances have Multi-AZ enabled
  allocated_storage          = 20
  auto_minor_version_upgrade = true
  availability_zone          = "us-east-1b"
  backup_retention_period    = 7
  backup_window              = "07:00-07:30"
  ca_cert_identifier         = "rds-ca-rsa2048-g1"
  copy_tags_to_snapshot      = true
  customer_owned_ip_enabled  = false
  db_name                    = "amp"
  db_subnet_group_name       = "amp-digarch-d-rds-sng"
  delete_automated_backups   = true
  deletion_protection        = true
  enabled_cloudwatch_logs_exports = [
    "postgresql",
    "upgrade",
  ]
  engine                              = "postgres"
  engine_version                      = "18.3"
  iam_database_authentication_enabled = false
  identifier                          = "amp-digital-archive-dev-rds-01"
  instance_class                      = "db.t3.small"
  iops                                = 3000
  kms_key_id                          = "arn:aws:kms:us-east-1:887829410671:key/b8a347b1-2907-4a1c-9a17-2875b1a93837"
  license_model                       = "postgresql-license"
  maintenance_window                  = "sun:08:00-sun:08:30"
  max_allocated_storage               = 25
  monitoring_interval                 = 60
  monitoring_role_arn                 = "arn:aws:iam::887829410671:role/rds-monitoring-role"
  multi_az                            = false
  network_type                        = "IPV4"
  parameter_group_name                = "amp-dgtl-archv-dev-rds-pg18"
  #database_insights_mode                = "standard"
  #performance_insights_enabled          = true
  #performance_insights_kms_key_id       = "arn:aws:kms:us-east-1:887829410671:key/b8a347b1-2907-4a1c-9a17-2875b1a93837"
  #performance_insights_retention_period = 7
  port                        = 5432
  publicly_accessible         = false
  skip_final_snapshot         = true
  storage_encrypted           = true
  storage_throughput          = 125
  storage_type                = "gp3"
  apply_immediately           = true
  allow_major_version_upgrade = true
  tags = {
    "Business-Unit" = "AMP-Digital-Archive"
    "Business-unit" = "SME-AMP"
    "Environment"   = "Dev"
    "Name"          = "amp-dev-rds-02"
    "Owner"         = "Nathaniel Lovett"
    "Project-Code"  = "SME-AMP"
    "Project-Name"  = "AMP"
    "Project-code"  = "SME-AMP"
    "Project-name"  = "AMP"
    "workload-type" = "other"
  }
  username = "master_rds"
  vpc_security_group_ids = [
    "sg-09e27d299f7cf621a",
  ]
}

