File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ type Validation struct {
34
34
Max int
35
35
MaxDisabled bool `mapstructure:"max_disabled"`
36
36
37
+ Invalid bool
37
38
Monotonic string
38
39
39
40
Regex string
@@ -363,6 +364,11 @@ func parameterDataSource() *schema.Resource {
363
364
Description : "A regex for the input parameter to match against." ,
364
365
Optional : true ,
365
366
},
367
+ "invalid" : {
368
+ Type : schema .TypeBool ,
369
+ Optional : true ,
370
+ Description : "If invalid is 'true', the error will be shown." ,
371
+ },
366
372
"error" : {
367
373
Type : schema .TypeString ,
368
374
Optional : true ,
@@ -452,6 +458,10 @@ func valueIsType(typ, value string) diag.Diagnostics {
452
458
}
453
459
454
460
func (v * Validation ) Valid (typ , value string ) error {
461
+ if v .Invalid {
462
+ return v .errorRendered (value )
463
+ }
464
+
455
465
if typ != "number" {
456
466
if ! v .MinDisabled {
457
467
return fmt .Errorf ("a min cannot be specified for a %s type" , typ )
You can’t perform that action at this time.
0 commit comments