Skip to content

Commit

Permalink
check regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
aslilac committed Dec 3, 2024
1 parent d3f6e2c commit 33e09a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/codersdkvalidator/regex.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package codersdkvalidator

import (
"regexp"

"github.com/hashicorp/terraform-plugin-framework/schema/validator"
)

func checkRegexp(it string) error {
_, err := regexp.Compile("")
return err
}

func Regexp() validator.String {
return validatorFromFunc(checkRegexp, "value must be a valid regexp")
}
1 change: 1 addition & 0 deletions internal/provider/organization_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func (r *OrganizationResource) Schema(ctx context.Context, req resource.SchemaRe
"not matched will be ignored.",
Validators: []validator.String{
stringvalidator.LengthAtLeast(1),
codersdkvalidator.Regexp(),
},
},
"auto_create_missing": schema.BoolAttribute{
Expand Down

0 comments on commit 33e09a9

Please sign in to comment.