Skip to content

Commit 07224a1

Browse files
committed
Add validation to database_password
1 parent aa260b3 commit 07224a1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ variable "database_password" {
179179
description = "Password for the database (should be provided via tfvars or environment variable)"
180180
type = string
181181
sensitive = true
182+
validation {
183+
condition = length(var.database_password) >= 8 && can(regex("^[[:print:]]+$", var.database_password)) && !can(regex("[/@\" ]", var.database_password))
184+
error_message = "Database password must be at least 8 characters, contain only printable ASCII characters, excluding '/', '@', '\"' (double quotes), and ' ' (space)."
185+
}
182186
}
183187

184188
variable "db_multi_az" {

0 commit comments

Comments
 (0)