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