21832: Allows to customize the initial RDS storage allocation.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 13 Jun 2024 19:21:21 +0000 (16:21 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 13 Jun 2024 19:21:21 +0000 (16:21 -0300)
Defaults to 20% of the default max storage allocation.
Also, don't ignore changes in password, as they don't require an RDS recreation
like username does.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

tools/salt-install/terraform/aws/services/locals.tf
tools/salt-install/terraform/aws/services/main.tf
tools/salt-install/terraform/aws/services/terraform.tfvars
tools/salt-install/terraform/aws/services/variables.tf

index 7512eb9df1c5cf686456709b4f7db9a7578623f1..906a2cf636f053e853e9afbbb62c8b797ae4d2d8 100644 (file)
@@ -32,6 +32,7 @@ locals {
   use_rds = (var.use_rds && data.terraform_remote_state.vpc.outputs.use_rds)
   rds_username = var.rds_username != "" ? var.rds_username : "${local.cluster_name}_arvados"
   rds_password = var.rds_password != "" ? var.rds_password : one(random_string.default_rds_password[*].result)
-  rds_max_allocated_storage = max(var.rds_max_allocated_storage, 20)
+  rds_allocated_storage = var.rds_allocated_storage
+  rds_max_allocated_storage = max(var.rds_max_allocated_storage, var.rds_allocated_storage)
   rds_instance_type = var.rds_instance_type
 }
index de4cfc9d2114d3d2627cd3ad396003eedb3561b4..d1e88a8dcabcd8518993a486dc87b8bbe9e6ba5a 100644 (file)
@@ -98,7 +98,7 @@ resource "aws_db_subnet_group" "arvados_db_subnet_group" {
 
 resource "aws_db_instance" "postgresql_service" {
   count = local.use_rds ? 1 : 0
-  allocated_storage = 20
+  allocated_storage = local.rds_allocated_storage
   max_allocated_storage = local.rds_max_allocated_storage
   engine = "postgres"
   engine_version = "15"
@@ -119,7 +119,6 @@ resource "aws_db_instance" "postgresql_service" {
   lifecycle {
     ignore_changes = [
       username,
-      password,
     ]
   }
 
index a1b0bd155528530526eaf69c7d606a15c0640328..1a2e13d0424a4e3fcc7a0b821f1436b612a55509 100644 (file)
@@ -29,6 +29,7 @@
 # rds_username = ""
 # rds_password = ""
 # rds_instance_type = "db.m5.xlarge"
+# rds_allocated_storage = 200
 # rds_max_allocated_storage = 1000
 
 # AWS secret's name which holds the SSL certificate private key's password.
index e9cebe6407ee72c3455e6f4d9d4842113c718167..583ba709764eb0d4c67db04d9c00fe27dfcc0cdb 100644 (file)
@@ -67,8 +67,14 @@ variable "rds_instance_type" {
   default = "db.m5.large"
 }
 
+variable "rds_allocated_storage" {
+  description = "RDS initial storage size (GiB)"
+  type = number
+  default = 60
+}
+
 variable "rds_max_allocated_storage" {
   description = "RDS maximum storage size that will autoscale to (GiB)"
   type = number
   default = 300
-}
\ No newline at end of file
+}