File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ type Validation struct {
3434 Max int
3535 MaxDisabled bool `mapstructure:"max_disabled"`
3636
37+ Invalid bool
3738 Monotonic string
3839
3940 Regex string
@@ -363,6 +364,11 @@ func parameterDataSource() *schema.Resource {
363364 Description : "A regex for the input parameter to match against." ,
364365 Optional : true ,
365366 },
367+ "invalid" : {
368+ Type : schema .TypeBool ,
369+ Optional : true ,
370+ Description : "If invalid is 'true', the error will be shown." ,
371+ },
366372 "error" : {
367373 Type : schema .TypeString ,
368374 Optional : true ,
@@ -452,6 +458,10 @@ func valueIsType(typ, value string) diag.Diagnostics {
452458}
453459
454460func (v * Validation ) Valid (typ , value string ) error {
461+ if v .Invalid {
462+ return v .errorRendered (value )
463+ }
464+
455465 if typ != "number" {
456466 if ! v .MinDisabled {
457467 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