Skip to content

Commit 64b4c3d

Browse files
authored
Merge pull request #124 from coder/stevenmasley/non-required-error
chore: remove 'error' as a required field in validation blocks
2 parents a1da434 + 1a73b15 commit 64b4c3d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

extract/parameter.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,23 +198,18 @@ func ParameterUsageDiagnostics(p types.Parameter) hcl.Diagnostics {
198198
}
199199

200200
func ParameterValidationFromBlock(block *terraform.Block) (types.ParameterValidation, hcl.Diagnostics) {
201-
diags := required(block, "error")
201+
diags := required(block)
202202
if diags.HasErrors() {
203203
return types.ParameterValidation{}, diags
204204
}
205205

206-
pErr, errDiag := requiredString(block, "error")
207-
if errDiag != nil {
208-
diags = diags.Append(errDiag)
209-
}
210-
211206
if diags.HasErrors() {
212207
return types.ParameterValidation{}, diags
213208
}
214209

215210
p := types.ParameterValidation{
216211
Regex: nullableString(block, "regex"),
217-
Error: pErr,
212+
Error: optionalString(block, "error"),
218213
Min: nullableInteger(block, "min"),
219214
Max: nullableInteger(block, "max"),
220215
Monotonic: nullableString(block, "monotonic"),

0 commit comments

Comments
 (0)