Browse Source

Updates Portal RDS

Sets up automated backups and changes the password. Forgive me for i have sinned. 
To be tagged v1.23.18
Brad Poulton 4 years ago
parent
commit
eeee05f309
1 changed files with 26 additions and 13 deletions
  1. 26 13
      base/customer_portal/rds.tf

+ 26 - 13
base/customer_portal/rds.tf

@@ -12,20 +12,33 @@ resource "aws_db_subnet_group" "customer_portal_rds_subnets" {
   subnet_ids  = var.private_subnets
 }
 
+# yeah, I alphabatized it. Don't you alphabatized your config files? 
 resource "aws_db_instance" "postgres" {
-  allocated_storage      = 20
-  storage_type           = "gp2"
-  engine                 = "postgres"
-  db_subnet_group_name   = aws_db_subnet_group.customer_portal_rds_subnets.name
-  vpc_security_group_ids = [ aws_security_group.postgres.id, ]
-  instance_class         = "db.t2.small"
-  identifier             = "customerportal"
-  name                   = "customerportal"
-  username               = "portal"
-  password               = "foobarbaz"
-  kms_key_id             = aws_kms_key.customer_portal_kms.arn
-  storage_encrypted      = "true"
-  ca_cert_identifier     = "rds-ca-2017"
+  allocated_storage           = 20
+  apply_immediately           = "true"
+  auto_minor_version_upgrade  = "true"
+  db_subnet_group_name        = aws_db_subnet_group.customer_portal_rds_subnets.name
+  backup_window               = "03:00-06:00"
+  backup_retention_period     = 7
+  ca_cert_identifier          = "rds-ca-2017"
+  deletion_protection         = var.environment == "test" ? "false" : "true"
+  delete_automated_backups    = "true"
+  engine                      = "postgres"
+  engine_version              = var.environment == "test" ? "12.4" : "10.15"
+  final_snapshot_identifier   = "customerportal"
+  instance_class              = "db.t2.small"
+  identifier                  = "customerportal"
+  kms_key_id                  = aws_kms_key.customer_portal_kms.arn
+  maintenance_window          = "Mon:00:00-Mon:03:00"
+  name                        = "customerportal"
+  password                    = var.environment == "test" ? "foobarbaz" : "050ff734-fb33-9248-13e4-7d8ad2e899a0"
+  port                        = 5432
+  skip_final_snapshot         = var.environment == "test" ? "true" : "false"
+  storage_type                = "gp2"
+  storage_encrypted           = "true"
+  tags                        = merge( var.standard_tags, var.tags )
+  username                    = var.environment == "test" ? "portal" : "root-e26bbf10-ee24-2d05-97b7-47c54d9224a1"
+  vpc_security_group_ids      = [ aws_security_group.postgres.id, ]
 }
 
 #------------------------------------