From cf19fe9a812e5f8e6ad171b3c38d2b606b549b7b Mon Sep 17 00:00:00 2001 From: jpadrianoGo Date: Tue, 10 Jun 2025 12:31:23 +0800 Subject: [PATCH 1/7] Added source to workspace --- workspace.go | 11 +++++++++++ workspace_integration_test.go | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/workspace.go b/workspace.go index 384a79ce3..2a8bc91a6 100644 --- a/workspace.go +++ b/workspace.go @@ -151,6 +151,16 @@ type workspaces struct { client *Client } +// WorkspaceSource represents a source type of a workspace. +type WorkspaceSource string + +const ( + WorkspaceSourceAPI WorkspaceSource = "tfe-api" + WorkspaceSourceModule WorkspaceSource = "tfe-module" + WorkspaceSourceUI WorkspaceSource = "tfe-ui" + WorkspaceSourceTerraform WorkspaceSource = "terraform" +) + // WorkspaceList represents a list of workspaces. type WorkspaceList struct { *Pagination @@ -198,6 +208,7 @@ type Workspace struct { Permissions *WorkspacePermissions `jsonapi:"attr,permissions"` QueueAllRuns bool `jsonapi:"attr,queue-all-runs"` SpeculativeEnabled bool `jsonapi:"attr,speculative-enabled"` + Source WorkspaceSource `jsonapi:"attr,source"` SourceName string `jsonapi:"attr,source-name"` SourceURL string `jsonapi:"attr,source-url"` StructuredRunOutputEnabled bool `jsonapi:"attr,structured-run-output-enabled"` diff --git a/workspace_integration_test.go b/workspace_integration_test.go index 52597a914..ad18518f0 100644 --- a/workspace_integration_test.go +++ b/workspace_integration_test.go @@ -1064,6 +1064,22 @@ func TestWorkspacesRead(t *testing.T) { }) } +func TestWorkspacesReadSource(t *testing.T) { + client := testClient(t) + ctx := context.Background() + + orgTest, orgTestCleanup := createOrganization(t, client) + t.Cleanup(orgTestCleanup) + + wTest, wTestCleanup := createWorkspace(t, client, orgTest) + t.Cleanup(wTestCleanup) + + w, err := client.Workspaces.Read(ctx, orgTest.Name, wTest.Name) + require.NoError(t, err) + + assert.Equal(t, WorkspaceSourceAPI, w.Source) +} + func TestWorkspacesReadWithOptions(t *testing.T) { client := testClient(t) ctx := context.Background() From bfa20627c770c812331b6b88362188b432744754 Mon Sep 17 00:00:00 2001 From: jpadrianoGo Date: Tue, 10 Jun 2025 12:36:58 +0800 Subject: [PATCH 2/7] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de3968c56..ece862f7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ * Adds BETA support for speculative runs with `Stacks` resources and removes VCS repo validity check on `Stack` creation, which is EXPERIMENTAL, SUBJECT TO CHANGE, and may not be available to all users by @hwatkins05-hashicorp [#1119](https://github.com/hashicorp/go-tfe/pull/1119) * Adds support for listing team tokens, by @mkam [#1109](https://github.com/hashicorp/go-tfe/pull/1109) +* Adds `Source` field to `Workspace`, by @jpadrianoGo [#1124](https://github.com/hashicorp/go-tfe/pull/1124) ## Bug Fixes From 962196fa538a80fb03b6b29a47fb01e9132b1b82 Mon Sep 17 00:00:00 2001 From: jpadrianoGo Date: Thu, 12 Jun 2025 10:38:59 +0800 Subject: [PATCH 3/7] Updated changelog --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ece862f7b..de3968c56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,6 @@ * Adds BETA support for speculative runs with `Stacks` resources and removes VCS repo validity check on `Stack` creation, which is EXPERIMENTAL, SUBJECT TO CHANGE, and may not be available to all users by @hwatkins05-hashicorp [#1119](https://github.com/hashicorp/go-tfe/pull/1119) * Adds support for listing team tokens, by @mkam [#1109](https://github.com/hashicorp/go-tfe/pull/1109) -* Adds `Source` field to `Workspace`, by @jpadrianoGo [#1124](https://github.com/hashicorp/go-tfe/pull/1124) ## Bug Fixes From 56b42c4d4824ba8a412ef2778a10f00e0722bb94 Mon Sep 17 00:00:00 2001 From: jpadrianoGo Date: Tue, 17 Jun 2025 05:19:02 +0800 Subject: [PATCH 4/7] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de3968c56..bb0553611 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ * Adds `PrivateRunTasks` field to Entitlements by @glennsarti [#944](https://github.com/hashicorp/go-tfe/pull/944) * Adds `AgentPool` relationship to options when creating and updating Run Tasks by @glennsarti [#944](https://github.com/hashicorp/go-tfe/pull/944) +* Adds `Source` field to `Workspace`, by @jpadrianoGo [#1124](https://github.com/hashicorp/go-tfe/pull/1124) + # v1.82.0 ## Enhancements From 57ca5839c536ec61a3a267a4ca8967c72bfd5cf3 Mon Sep 17 00:00:00 2001 From: jpadrianoGo Date: Wed, 18 Jun 2025 11:04:11 +0800 Subject: [PATCH 5/7] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb0553611..ec251d736 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ * Adds BETA support for listing and reading `StackDeploymentSteps`, which is EXPERIMENTAL, SUBJECT TO CHANGE, and may not be available to all users by @ctrombley [#1133](https://github.com/hashicorp/go-tfe/pull/1133) * Adds BETA support for approving all plans in `StackDeploymentGroups`, which is EXPERIMENTAL, SUBJECT TO CHANGE, and may not be available to all users by @hwatkins05-hashicorp [#1137](https://github.com/hashicorp/go-tfe/pull/1137) +* Adds `Source` field to `Workspace`, by @jpadrianoGo [#1124](https://github.com/hashicorp/go-tfe/pull/1124) + # v1.83.0 ## Enhancements From 918abcbb23a7abaf1862d410895f58c3f1dda264 Mon Sep 17 00:00:00 2001 From: jpadrianoGo Date: Thu, 19 Jun 2025 05:45:25 +0800 Subject: [PATCH 6/7] Updated changelog --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec251d736..e41e4816d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,7 @@ * Adds BETA support for approving all plans for a stack deployment run, which is EXPERIMENTAL, SUBJECT TO CHANGE, and may not be available to all users by @ctrombley [#1136](https://github.com/hashicorp/go-tfe/pull/1136) * Adds BETA support for listing and reading `StackDeploymentSteps`, which is EXPERIMENTAL, SUBJECT TO CHANGE, and may not be available to all users by @ctrombley [#1133](https://github.com/hashicorp/go-tfe/pull/1133) * Adds BETA support for approving all plans in `StackDeploymentGroups`, which is EXPERIMENTAL, SUBJECT TO CHANGE, and may not be available to all users by @hwatkins05-hashicorp [#1137](https://github.com/hashicorp/go-tfe/pull/1137) - -* Adds `Source` field to `Workspace`, by @jpadrianoGo [#1124](https://github.com/hashicorp/go-tfe/pull/1124) +* Adds `Source` field to `Workspace` by @jpadrianoGo [#1124](https://github.com/hashicorp/go-tfe/pull/1124) # v1.83.0 From 95a4812dd56850087fca962e1320c27681f8a2b0 Mon Sep 17 00:00:00 2001 From: jpadrianoGo Date: Thu, 19 Jun 2025 05:46:21 +0800 Subject: [PATCH 7/7] Updated changelog --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e41e4816d..96ed19dfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,8 +22,6 @@ * Adds `PrivateRunTasks` field to Entitlements by @glennsarti [#944](https://github.com/hashicorp/go-tfe/pull/944) * Adds `AgentPool` relationship to options when creating and updating Run Tasks by @glennsarti [#944](https://github.com/hashicorp/go-tfe/pull/944) -* Adds `Source` field to `Workspace`, by @jpadrianoGo [#1124](https://github.com/hashicorp/go-tfe/pull/1124) - # v1.82.0 ## Enhancements