Skip to content

Commit d590d6f

Browse files
committed
PR comments
1 parent b8d8b63 commit d590d6f

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

internal/provider/template_data_source.go

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
"github.com/coder/coder/v2/codersdk"
88
"github.com/google/uuid"
9-
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
109
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
1110
"github.com/hashicorp/terraform-plugin-framework/datasource"
1211
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
@@ -17,7 +16,6 @@ import (
1716

1817
// Ensure provider defined types fully satisfy framework interfaces.
1918
var _ datasource.DataSource = &TemplateDataSource{}
20-
var _ datasource.DataSourceWithConfigValidators = &TemplateDataSource{}
2119

2220
func NewTemplateDataSource() datasource.DataSource {
2321
return &TemplateDataSource{}
@@ -73,11 +71,11 @@ func (d *TemplateDataSource) Metadata(ctx context.Context, req datasource.Metada
7371

7472
func (d *TemplateDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
7573
resp.Schema = schema.Schema{
76-
MarkdownDescription: "An existing template on the coder deployment",
74+
MarkdownDescription: "An existing template on the Coder deployment.",
7775

7876
Attributes: map[string]schema.Attribute{
7977
"organization_id": schema.StringAttribute{
80-
MarkdownDescription: "ID of the organization the template is associated with.",
78+
MarkdownDescription: "ID of the organization the template is associated with. This field will be populated if an ID is supplied. Defaults to the provider default organization ID.",
8179
CustomType: UUIDType,
8280
Optional: true,
8381
Computed: true,
@@ -161,7 +159,7 @@ func (d *TemplateDataSource) Schema(ctx context.Context, req datasource.SchemaRe
161159
Computed: true,
162160
},
163161
"require_active_version": schema.BoolAttribute{
164-
MarkdownDescription: "Whether workspaces created from the template must be up-to-datae on the latest active version.",
162+
MarkdownDescription: "Whether workspaces created from the template must be up-to-date on the latest active version.",
165163
Computed: true,
166164
},
167165
"created_by_user_id": schema.StringAttribute{
@@ -272,12 +270,3 @@ func (d *TemplateDataSource) Read(ctx context.Context, req datasource.ReadReques
272270
// Save data into Terraform state
273271
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
274272
}
275-
276-
func (d *TemplateDataSource) ConfigValidators(context.Context) []datasource.ConfigValidator {
277-
return []datasource.ConfigValidator{
278-
datasourcevalidator.AtLeastOneOf(
279-
path.MatchRoot("id"),
280-
path.MatchRoot("name"),
281-
),
282-
}
283-
}

internal/provider/template_data_source_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func TestAccTemplateDataSource(t *testing.T) {
175175
Steps: []resource.TestStep{
176176
{
177177
Config: cfg.String(t),
178-
ExpectError: regexp.MustCompile(`At least one of these attributes must be configured: \[id,name\]`),
178+
ExpectError: regexp.MustCompile(`At least one attribute out of \[name,id\] must be specified`),
179179
},
180180
},
181181
})

0 commit comments

Comments
 (0)