@@ -13,6 +13,7 @@ import (
1313 "github.com/coder/coder/v2/coderd/util/ptr"
1414 "github.com/coder/coder/v2/codersdk"
1515 "github.com/coder/coder/v2/provisionersdk"
16+ "github.com/coder/terraform-provider-coderd/internal/codersdkvalidator"
1617 "github.com/google/uuid"
1718 "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
1819 "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
@@ -258,17 +259,15 @@ func (r *TemplateResource) Schema(ctx context.Context, req resource.SchemaReques
258259 MarkdownDescription : "The name of the template." ,
259260 Required : true ,
260261 Validators : []validator.String {
261- stringvalidator .LengthBetween (1 , 32 ),
262- stringvalidator .RegexMatches (nameValidRegex , "Template names must be alphanumeric with hyphens." ),
262+ codersdkvalidator .Name (),
263263 },
264264 },
265265 "display_name" : schema.StringAttribute {
266266 MarkdownDescription : "The display name of the template. Defaults to the template name." ,
267267 Optional : true ,
268268 Computed : true ,
269269 Validators : []validator.String {
270- stringvalidator .LengthBetween (1 , 64 ),
271- stringvalidator .RegexMatches (displayNameRegex , "Template display names must be alphanumeric with spaces." ),
270+ codersdkvalidator .DisplayName (),
272271 },
273272 },
274273 "description" : schema.StringAttribute {
@@ -418,8 +417,7 @@ func (r *TemplateResource) Schema(ctx context.Context, req resource.SchemaReques
418417 Optional : true ,
419418 Computed : true ,
420419 Validators : []validator.String {
421- stringvalidator .LengthBetween (1 , 64 ),
422- stringvalidator .RegexMatches (templateVersionNameRegex , "Template version names must be alphanumeric with underscores and dots." ),
420+ codersdkvalidator .TemplateVersionName (),
423421 },
424422 },
425423 "message" : schema.StringAttribute {
0 commit comments