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>
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
}
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"
lifecycle {
ignore_changes = [
username,
- password,
]
}
# 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.
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
+}