From c948fb300e7158f6186064feefe87af1e17c6404 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Thu, 13 Jun 2024 16:21:21 -0300 Subject: [PATCH] 21832: Allows to customize the initial RDS storage allocation. 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 --- tools/salt-install/terraform/aws/services/locals.tf | 3 ++- tools/salt-install/terraform/aws/services/main.tf | 3 +-- .../salt-install/terraform/aws/services/terraform.tfvars | 1 + tools/salt-install/terraform/aws/services/variables.tf | 8 +++++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/salt-install/terraform/aws/services/locals.tf b/tools/salt-install/terraform/aws/services/locals.tf index 7512eb9df1..906a2cf636 100644 --- a/tools/salt-install/terraform/aws/services/locals.tf +++ b/tools/salt-install/terraform/aws/services/locals.tf @@ -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 } diff --git a/tools/salt-install/terraform/aws/services/main.tf b/tools/salt-install/terraform/aws/services/main.tf index de4cfc9d21..d1e88a8dca 100644 --- a/tools/salt-install/terraform/aws/services/main.tf +++ b/tools/salt-install/terraform/aws/services/main.tf @@ -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, ] } diff --git a/tools/salt-install/terraform/aws/services/terraform.tfvars b/tools/salt-install/terraform/aws/services/terraform.tfvars index a1b0bd1555..1a2e13d042 100644 --- a/tools/salt-install/terraform/aws/services/terraform.tfvars +++ b/tools/salt-install/terraform/aws/services/terraform.tfvars @@ -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. diff --git a/tools/salt-install/terraform/aws/services/variables.tf b/tools/salt-install/terraform/aws/services/variables.tf index e9cebe6407..583ba70976 100644 --- a/tools/salt-install/terraform/aws/services/variables.tf +++ b/tools/salt-install/terraform/aws/services/variables.tf @@ -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 +} -- 2.30.2