Skip to content

Commit f072e9a

Browse files
committed
Do not set min/max values in the module
Rather than setting the values for min/max in the module, we pass them in for better visibility
1 parent ab50fcd commit f072e9a

1 file changed

Lines changed: 3 additions & 32 deletions

File tree

infra/modules/rds/rds.tf

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,6 @@ locals {
2424
performance_insights_retention_period = var.enable_advanced_database_insights ? 465 : null
2525
}
2626

27-
locals {
28-
serverlessv2_scaling_profiles = {
29-
30-
dev = {
31-
# 0.5 is the lowest value that keeps the cluster warm (no cold start on first connection).
32-
# Setting min_capacity = 0 would enable auto-pause but cause ~20-30s wake-up delays.
33-
min_capacity = 0.5
34-
max_capacity = 2
35-
}
36-
37-
default = {
38-
min_capacity = var.min_capacity
39-
max_capacity = var.max_capacity
40-
}
41-
}
42-
43-
serverlessv2_scaling = lookup(
44-
local.serverlessv2_scaling_profiles,
45-
var.env_name,
46-
local.serverlessv2_scaling_profiles["default"]
47-
)
48-
}
49-
5027
resource "aws_rds_cluster" "cluster_aurora_v2" {
5128
#checkov:skip=CKV2_AWS_8:AWS RDS inbuilt backup process is sufficient
5229
#checkov:skip=CKV2_AWS_27:Query logging is not required at this time
@@ -91,15 +68,9 @@ resource "aws_rds_cluster" "cluster_aurora_v2" {
9168
performance_insights_enabled = var.enable_advanced_database_insights
9269
performance_insights_retention_period = local.performance_insights_retention_period
9370

94-
dynamic "serverlessv2_scaling_configuration" {
95-
for_each = [local.serverlessv2_scaling]
96-
97-
content {
98-
min_capacity = serverlessv2_scaling_configuration.value.min_capacity
99-
max_capacity = serverlessv2_scaling_configuration.value.max_capacity
100-
101-
seconds_until_auto_pause = try(serverlessv2_scaling_configuration.value.seconds_until_auto_pause, null)
102-
}
71+
serverlessv2_scaling_configuration {
72+
max_capacity = var.max_capacity
73+
min_capacity = var.min_capacity
10374
}
10475

10576
lifecycle {

0 commit comments

Comments
 (0)