-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Max db connections #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,6 +20,12 @@ variable "postgres_version" { | |||||||||||||||||||||||||||||||
| default = "POSTGRES_17" | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| variable "max_database_connections" { | ||||||||||||||||||||||||||||||||
| description = "The maximum number of connections to the database" | ||||||||||||||||||||||||||||||||
| type = string | ||||||||||||||||||||||||||||||||
| default = "" | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
Comment on lines
+23
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider using a numeric type or adding validation for
This ensures users can’t pass invalid inputs and improves type safety. variable "max_database_connections" {
description = "The maximum number of connections to the database"
- type = string
- default = ""
+ type = number
+ default = null
+ validation {
+ condition = var.max_database_connections == null || var.max_database_connections >= 0
+ error_message = "max_database_connections must be a non-negative number or null"
+ }
}📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| variable "redis_tier" { | ||||||||||||||||||||||||||||||||
| description = "The tier for the Redis instance" | ||||||||||||||||||||||||||||||||
| type = string | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Align module variable type with root or add validation.
Just like in the root, the database module’s
max_database_connectionsshould either:numberwithdefault = nulland validation, orstringtype but include avalidationclause to enforce numeric content.Consistency prevents runtime errors when passing values across modules.
variable "max_database_connections" { description = "The maximum number of connections to the database" - type = string - default = "" + type = number + default = null + validation { + condition = var.max_database_connections == null || var.max_database_connections >= 0 + error_message = "max_database_connections must be a non-negative number or null" + } }📝 Committable suggestion