Skip to content

Commit d14d6ee

Browse files
committed
chore!: remove deprecated owner-related fields from workspace data source
The owner-related fields (`owner`, `owner_email`, `owner_id`, `owner_name`, `owner_oidc_access_token`, `owner_groups`, `owner_session_token`) in the workspace data source have been deprecated. This commit removes these fields from the codebase.
1 parent d2e2d96 commit d14d6ee

File tree

3 files changed

+3
-80
lines changed

3 files changed

+3
-80
lines changed

docs/data-sources/workspace.md

-7
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ resource "kubernetes_pod" "dev" {
3030
- `access_url` (String) The access URL of the Coder deployment provisioning this workspace.
3131
- `id` (String) UUID of the workspace.
3232
- `name` (String) Name of the workspace.
33-
- `owner` (String, **Deprecated**: Use `coder_workspace_owner.name` instead.) Username of the workspace owner.
34-
- `owner_email` (String, **Deprecated**: Use `coder_workspace_owner.email` instead.) Email address of the workspace owner.
35-
- `owner_groups` (List of String, **Deprecated**: Use `coder_workspace_owner.groups` instead.) List of groups the workspace owner belongs to.
36-
- `owner_id` (String, **Deprecated**: Use `coder_workspace_owner.id` instead.) UUID of the workspace owner.
37-
- `owner_name` (String, **Deprecated**: Use `coder_workspace_owner.full_name` instead.) Name of the workspace owner.
38-
- `owner_oidc_access_token` (String, **Deprecated**: Use `coder_workspace_owner.oidc_access_token` instead.) A valid OpenID Connect access token of the workspace owner. This is only available if the workspace owner authenticated with OpenID Connect. If a valid token cannot be obtained, this value will be an empty string.
39-
- `owner_session_token` (String, **Deprecated**: Use `coder_workspace_owner.session_token` instead.) Session token for authenticating with a Coder deployment. It is regenerated everytime a workspace is started.
4033
- `start_count` (Number) A computed count based on `transition` state. If `start`, count will equal 1.
4134
- `template_id` (String) ID of the workspace's template.
4235
- `template_name` (String) Name of the workspace's template.

provider/workspace.go

-47
Original file line numberDiff line numberDiff line change
@@ -122,47 +122,6 @@ func workspaceDataSource() *schema.Resource {
122122
Computed: true,
123123
Description: "Either `start` or `stop`. Use this to start/stop resources with `count`.",
124124
},
125-
"owner": {
126-
Type: schema.TypeString,
127-
Computed: true,
128-
Description: "Username of the workspace owner.",
129-
Deprecated: "Use `coder_workspace_owner.name` instead.",
130-
},
131-
"owner_email": {
132-
Type: schema.TypeString,
133-
Computed: true,
134-
Description: "Email address of the workspace owner.",
135-
Deprecated: "Use `coder_workspace_owner.email` instead.",
136-
},
137-
"owner_id": {
138-
Type: schema.TypeString,
139-
Computed: true,
140-
Description: "UUID of the workspace owner.",
141-
Deprecated: "Use `coder_workspace_owner.id` instead.",
142-
},
143-
"owner_name": {
144-
Type: schema.TypeString,
145-
Computed: true,
146-
Description: "Name of the workspace owner.",
147-
Deprecated: "Use `coder_workspace_owner.full_name` instead.",
148-
},
149-
"owner_oidc_access_token": {
150-
Type: schema.TypeString,
151-
Computed: true,
152-
Description: "A valid OpenID Connect access token of the workspace owner. " +
153-
"This is only available if the workspace owner authenticated with OpenID Connect. " +
154-
"If a valid token cannot be obtained, this value will be an empty string.",
155-
Deprecated: "Use `coder_workspace_owner.oidc_access_token` instead.",
156-
},
157-
"owner_groups": {
158-
Type: schema.TypeList,
159-
Elem: &schema.Schema{
160-
Type: schema.TypeString,
161-
},
162-
Computed: true,
163-
Description: "List of groups the workspace owner belongs to.",
164-
Deprecated: "Use `coder_workspace_owner.groups` instead.",
165-
},
166125
"id": {
167126
Type: schema.TypeString,
168127
Computed: true,
@@ -173,12 +132,6 @@ func workspaceDataSource() *schema.Resource {
173132
Computed: true,
174133
Description: "Name of the workspace.",
175134
},
176-
"owner_session_token": {
177-
Type: schema.TypeString,
178-
Computed: true,
179-
Description: "Session token for authenticating with a Coder deployment. It is regenerated everytime a workspace is started.",
180-
Deprecated: "Use `coder_workspace_owner.session_token` instead.",
181-
},
182135
"template_id": {
183136
Type: schema.TypeString,
184137
Computed: true,

provider/workspace_test.go

+3-26
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ import (
1414
)
1515

1616
func TestWorkspace(t *testing.T) {
17-
t.Setenv("CODER_WORKSPACE_OWNER", "owner123")
18-
t.Setenv("CODER_WORKSPACE_OWNER_ID", "11111111-1111-1111-1111-111111111111")
19-
t.Setenv("CODER_WORKSPACE_OWNER_NAME", "Mr Owner")
20-
t.Setenv("CODER_WORKSPACE_OWNER_EMAIL", "[email protected]")
21-
t.Setenv("CODER_WORKSPACE_OWNER_SESSION_TOKEN", "abc123")
22-
t.Setenv("CODER_WORKSPACE_OWNER_GROUPS", `["group1", "group2"]`)
23-
t.Setenv("CODER_WORKSPACE_OWNER_OIDC_ACCESS_TOKEN", "supersecret")
2417
t.Setenv("CODER_WORKSPACE_TEMPLATE_ID", "templateID")
2518
t.Setenv("CODER_WORKSPACE_TEMPLATE_NAME", "template123")
2619
t.Setenv("CODER_WORKSPACE_TEMPLATE_VERSION", "v1.2.3")
@@ -49,26 +42,16 @@ func TestWorkspace(t *testing.T) {
4942
t.Log(value)
5043
assert.Equal(t, "https://example.com:8080", attribs["access_url"])
5144
assert.Equal(t, "8080", attribs["access_port"])
52-
assert.Equal(t, "owner123", attribs["owner"])
53-
assert.Equal(t, "11111111-1111-1111-1111-111111111111", attribs["owner_id"])
54-
assert.Equal(t, "Mr Owner", attribs["owner_name"])
55-
assert.Equal(t, "[email protected]", attribs["owner_email"])
56-
assert.Equal(t, "group1", attribs["owner_groups.0"])
57-
assert.Equal(t, "group2", attribs["owner_groups.1"])
5845
assert.Equal(t, "templateID", attribs["template_id"])
5946
assert.Equal(t, "template123", attribs["template_name"])
6047
assert.Equal(t, "v1.2.3", attribs["template_version"])
61-
assert.Equal(t, "supersecret", attribs["owner_oidc_access_token"])
6248
return nil
6349
},
6450
}},
6551
})
6652
}
6753

6854
func TestWorkspace_UndefinedOwner(t *testing.T) {
69-
t.Setenv("CODER_WORKSPACE_OWNER", "owner123")
70-
t.Setenv("CODER_WORKSPACE_OWNER_SESSION_TOKEN", "abc123")
71-
t.Setenv("CODER_WORKSPACE_OWNER_GROUPS", `["group1", "group2"]`)
7255
t.Setenv("CODER_WORKSPACE_TEMPLATE_ID", "templateID")
7356
t.Setenv("CODER_WORKSPACE_TEMPLATE_NAME", "template123")
7457
t.Setenv("CODER_WORKSPACE_TEMPLATE_VERSION", "v1.2.3")
@@ -95,8 +78,9 @@ func TestWorkspace_UndefinedOwner(t *testing.T) {
9578
value := attribs["transition"]
9679
require.NotNil(t, value)
9780
t.Log(value)
98-
assert.Equal(t, "owner123", attribs["owner"])
99-
assert.Equal(t, "[email protected]", attribs["owner_email"])
81+
assert.Equal(t, "templateID", attribs["template_id"])
82+
assert.Equal(t, "template123", attribs["template_name"])
83+
assert.Equal(t, "v1.2.3", attribs["template_version"])
10084
// Skip other asserts
10185
return nil
10286
},
@@ -107,13 +91,6 @@ func TestWorkspace_UndefinedOwner(t *testing.T) {
10791
func TestWorkspace_MissingTemplateName(t *testing.T) {
10892
t.Setenv("CODER_WORKSPACE_BUILD_ID", "1") // Let's pretend this is a workspace build
10993

110-
t.Setenv("CODER_WORKSPACE_OWNER", "owner123")
111-
t.Setenv("CODER_WORKSPACE_OWNER_ID", "11111111-1111-1111-1111-111111111111")
112-
t.Setenv("CODER_WORKSPACE_OWNER_NAME", "Mr Owner")
113-
t.Setenv("CODER_WORKSPACE_OWNER_EMAIL", "[email protected]")
114-
t.Setenv("CODER_WORKSPACE_OWNER_SESSION_TOKEN", "abc123")
115-
t.Setenv("CODER_WORKSPACE_OWNER_GROUPS", `["group1", "group2"]`)
116-
t.Setenv("CODER_WORKSPACE_OWNER_OIDC_ACCESS_TOKEN", "supersecret")
11794
t.Setenv("CODER_WORKSPACE_TEMPLATE_ID", "templateID")
11895
// CODER_WORKSPACE_TEMPLATE_NAME is missing
11996
t.Setenv("CODER_WORKSPACE_TEMPLATE_VERSION", "v1.2.3")

0 commit comments

Comments
 (0)