feat: support custom validation errors for number-typed parameters (#12224)

This commit is contained in:
Marcin Tojek
2024-02-20 16:32:03 +01:00
committed by GitHub
parent 6414b7aade
commit 57bf997369
7 changed files with 156 additions and 9 deletions
+17
View File
@@ -249,6 +249,23 @@ data "coder_parameter" "instances" {
}
```
It is possible to override the default `error` message for a `number` parameter,
along with its associated `min` and/or `max` properties. The following message
placeholders are available `{min}`, `{max}`, and `{value}`.
```hcl
data "coder_parameter" "instances" {
name = "Instances"
type = "number"
description = "Number of compute instances"
validation {
min = 1
max = 4
error = "Sorry, we can't provision too many instances - maximum limit: {max}, wanted: {value}."
}
}
```
### String
You can validate a `string` parameter to match a regular expression. The `regex`