Skip to content

Commit 5a2db27

Browse files
committed
add validation for nodegroup name clashes
1 parent 45fb0cc commit 5a2db27

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

environments/site/tofu/variables.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ variable "login" {
9191
validation {
9292
condition = length(setintersection(keys(var.login), ["login", "compute", "control"])) == 0
9393
error_message = <<-EOF
94-
Login nodegroup names cannot be 'login', 'compute' or 'control'. Invalid var.login keys: ${join(", ", setintersection(keys(var.login), ["login", "compute", "control"]))}.
94+
Login nodegroup names cannot be 'login', 'compute' or 'control'. Invalid var.login key(s): ${join(", ", setintersection(keys(var.login), ["login", "compute", "control"]))}.
9595
EOF
9696
}
9797
}
@@ -148,7 +148,13 @@ variable "compute" {
148148
validation {
149149
condition = length(setintersection(keys(var.compute), ["login", "compute", "control", "default"])) == 0
150150
error_message = <<-EOF
151-
Compute nodegroup names cannot be 'compute', 'default', 'login' or 'control'. Invalid var.compute keys: ${join(", ", setintersection(keys(var.compute), ["login", "compute", "control", "default"]))}.
151+
Compute nodegroup names cannot be 'compute', 'default', 'login' or 'control'. Invalid var.compute key(s): ${join(", ", setintersection(keys(var.compute), ["login", "compute", "control", "default"]))}.
152+
EOF
153+
}
154+
validation {
155+
condition = length(setintersection(keys(var.compute), keys(var.login))) == 0
156+
error_message = <<-EOF
157+
Compute and login nodegroups cannot have the same name. Invalid var.compute/var.login key(s): ${join(", ", setintersection(keys(var.compute), keys(var.login)))}
152158
EOF
153159
}
154160
}

0 commit comments

Comments
 (0)