Skip to content

Commit df8ab98

Browse files
committed
fix: support non-enterprise template resources
1 parent c773873 commit df8ab98

File tree

8 files changed

+171
-128
lines changed

8 files changed

+171
-128
lines changed

docs/data-sources/template.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
page_title: "coderd_template Data Source - coderd"
44
subcategory: ""
55
description: |-
6-
An existing template on the coder deployment
6+
An existing template on the Coder deployment.
77
---
88

99
# coderd_template (Data Source)
1010

11-
An existing template on the coder deployment
11+
An existing template on the Coder deployment.
1212

1313

1414

@@ -19,7 +19,7 @@ An existing template on the coder deployment
1919

2020
- `id` (String) The ID of the template to retrieve. This field will be populated if a template name is supplied.
2121
- `name` (String) The name of the template to retrieve. This field will be populated if an ID is supplied.
22-
- `organization_id` (String) ID of the organization the template is associated with.
22+
- `organization_id` (String) 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.
2323

2424
### Read-Only
2525

@@ -38,7 +38,7 @@ An existing template on the coder deployment
3838
- `display_name` (String) Display name of the template.
3939
- `failure_ttl_ms` (Number) Automatic cleanup TTL for failed workspace builds.
4040
- `icon` (String) URL of the template's icon.
41-
- `require_active_version` (Boolean) Whether workspaces created from the template must be up-to-datae on the latest active version.
41+
- `require_active_version` (Boolean) Whether workspaces created from the template must be up-to-date on the latest active version.
4242
- `time_til_dormant_autodelete_ms` (Number) Duration of inactivity after the workspace becomes dormant before a workspace is automatically deleted.
4343
- `time_til_dormant_ms` (Number) Duration of inactivity before a workspace is considered dormant.
4444
- `updated_at` (Number) Unix timestamp of when the template was last updated.

docs/resources/group.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ A group on the Coder deployment. If you want to have a group resource with unman
2323

2424
- `avatar_url` (String) The URL of the group's avatar.
2525
- `display_name` (String) The display name of the group. Defaults to the group name.
26-
- `members` (Set of String) Members of the group, by ID. If null, members will not be added or removed.
26+
- `members` (Set of String) Members of the group, by ID. If null, members will not be added or removed by Terraform.
2727
- `organization_id` (String) The organization ID that the group belongs to. Defaults to the provider default organization ID.
2828
- `quota_allowance` (Number) The number of quota credits to allocate to each user in the group.
2929

docs/resources/template.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ A Coder template
1717

1818
### Required
1919

20-
- `acl` (Attributes) Access control list for the template. (see [below for nested schema](#nestedatt--acl))
2120
- `name` (String) The name of the template.
2221
- `versions` (Attributes List) (see [below for nested schema](#nestedatt--versions))
2322

2423
### Optional
2524

25+
- `acl` (Attributes) Access control list for the template. Requires an enterprise Coder deployment. If null, ACL policies will not be added or removed by Terraform. (see [below for nested schema](#nestedatt--acl))
2626
- `allow_user_auto_start` (Boolean)
2727
- `allow_user_auto_stop` (Boolean)
2828
- `description` (String) A description of the template.
@@ -34,33 +34,6 @@ A Coder template
3434

3535
- `id` (String) The ID of the template.
3636

37-
<a id="nestedatt--acl"></a>
38-
### Nested Schema for `acl`
39-
40-
Required:
41-
42-
- `groups` (Attributes Set) (see [below for nested schema](#nestedatt--acl--groups))
43-
- `users` (Attributes Set) (see [below for nested schema](#nestedatt--acl--users))
44-
45-
<a id="nestedatt--acl--groups"></a>
46-
### Nested Schema for `acl.groups`
47-
48-
Required:
49-
50-
- `id` (String)
51-
- `role` (String)
52-
53-
54-
<a id="nestedatt--acl--users"></a>
55-
### Nested Schema for `acl.users`
56-
57-
Required:
58-
59-
- `id` (String)
60-
- `role` (String)
61-
62-
63-
6437
<a id="nestedatt--versions"></a>
6538
### Nested Schema for `versions`
6639

@@ -97,3 +70,30 @@ Required:
9770

9871
- `name` (String)
9972
- `value` (String)
73+
74+
75+
76+
<a id="nestedatt--acl"></a>
77+
### Nested Schema for `acl`
78+
79+
Required:
80+
81+
- `groups` (Attributes Set) (see [below for nested schema](#nestedatt--acl--groups))
82+
- `users` (Attributes Set) (see [below for nested schema](#nestedatt--acl--users))
83+
84+
<a id="nestedatt--acl--groups"></a>
85+
### Nested Schema for `acl.groups`
86+
87+
Required:
88+
89+
- `id` (String)
90+
- `role` (String)
91+
92+
93+
<a id="nestedatt--acl--users"></a>
94+
### Nested Schema for `acl.users`
95+
96+
Required:
97+
98+
- `id` (String)
99+
- `role` (String)

internal/provider/group_data_source.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,10 @@ func (d *GroupDataSource) Read(ctx context.Context, req datasource.ReadRequest,
174174
data.OrganizationID = UUIDValue(d.data.DefaultOrganizationID)
175175
}
176176

177-
var group codersdk.Group
178-
var err error
177+
var (
178+
group codersdk.Group
179+
err error
180+
)
179181
if !data.ID.IsNull() {
180182
groupID := data.ID.ValueUUID()
181183
group, err = client.Group(ctx, groupID)

internal/provider/group_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (r *GroupResource) Schema(ctx context.Context, req resource.SchemaRequest,
9393
},
9494
},
9595
"members": schema.SetAttribute{
96-
MarkdownDescription: "Members of the group, by ID. If null, members will not be added or removed.",
96+
MarkdownDescription: "Members of the group, by ID. If null, members will not be added or removed by Terraform.",
9797
ElementType: UUIDType,
9898
Optional: true,
9999
},

internal/provider/organization_data_source.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ func (d *OrganizationDataSource) Read(ctx context.Context, req datasource.ReadRe
115115

116116
client := d.data.Client
117117

118-
var org codersdk.Organization
119-
var err error
118+
var (
119+
org codersdk.Organization
120+
err error
121+
)
120122
if !data.ID.IsNull() { // By ID
121123
orgID := data.ID.ValueUUID()
122124
org, err = client.Organization(ctx, orgID)

0 commit comments

Comments
 (0)