Skip to content

Commit 33e09a9

Browse files
committed
check regexp
1 parent d3f6e2c commit 33e09a9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

internal/codersdkvalidator/regex.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package codersdkvalidator
2+
3+
import (
4+
"regexp"
5+
6+
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
7+
)
8+
9+
func checkRegexp(it string) error {
10+
_, err := regexp.Compile("")
11+
return err
12+
}
13+
14+
func Regexp() validator.String {
15+
return validatorFromFunc(checkRegexp, "value must be a valid regexp")
16+
}

internal/provider/organization_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ func (r *OrganizationResource) Schema(ctx context.Context, req resource.SchemaRe
151151
"not matched will be ignored.",
152152
Validators: []validator.String{
153153
stringvalidator.LengthAtLeast(1),
154+
codersdkvalidator.Regexp(),
154155
},
155156
},
156157
"auto_create_missing": schema.BoolAttribute{

0 commit comments

Comments
 (0)