@@ -13,6 +13,7 @@ import (
13
13
"github.com/coder/coder/v2/coderd/util/ptr"
14
14
"github.com/coder/coder/v2/codersdk"
15
15
"github.com/coder/coder/v2/provisionersdk"
16
+ "github.com/coder/terraform-provider-coderd/internal/codersdkvalidator"
16
17
"github.com/google/uuid"
17
18
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
18
19
"github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
@@ -258,17 +259,15 @@ func (r *TemplateResource) Schema(ctx context.Context, req resource.SchemaReques
258
259
MarkdownDescription : "The name of the template." ,
259
260
Required : true ,
260
261
Validators : []validator.String {
261
- stringvalidator .LengthBetween (1 , 32 ),
262
- stringvalidator .RegexMatches (nameValidRegex , "Template names must be alphanumeric with hyphens." ),
262
+ codersdkvalidator .Name (),
263
263
},
264
264
},
265
265
"display_name" : schema.StringAttribute {
266
266
MarkdownDescription : "The display name of the template. Defaults to the template name." ,
267
267
Optional : true ,
268
268
Computed : true ,
269
269
Validators : []validator.String {
270
- stringvalidator .LengthBetween (1 , 64 ),
271
- stringvalidator .RegexMatches (displayNameRegex , "Template display names must be alphanumeric with spaces." ),
270
+ codersdkvalidator .DisplayName (),
272
271
},
273
272
},
274
273
"description" : schema.StringAttribute {
@@ -418,8 +417,7 @@ func (r *TemplateResource) Schema(ctx context.Context, req resource.SchemaReques
418
417
Optional : true ,
419
418
Computed : true ,
420
419
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 (),
423
421
},
424
422
},
425
423
"message" : schema.StringAttribute {
0 commit comments