Skip to content

Commit a82d7c5

Browse files
Merge branch 'main' into registry-get-module
2 parents 222ae11 + d114b5d commit a82d7c5

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Enhancements
44

55
* Add support for proxied Terraform Registry endpoints for reading detailed module information by @paladin-devops [#1057](https://github.com/hashicorp/go-tfe/pull/1057)
6+
* Adds `DefaultProject` to `OrganizationUpdateOptions` to support updating an organization's default project. This provides BETA support, which is EXPERIMENTAL, SUBJECT TO CHANGE, and may not be available to all users, by @mkam [#1056](https://github.com/hashicorp/go-tfe/pull/1056)
67

78
## Bug fixes
89

organization.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ type OrganizationUpdateOptions struct {
311311
// Optional: StacksEnabled toggles whether stacks are enabled for the organization. This setting
312312
// is considered BETA, SUBJECT TO CHANGE, and likely unavailable to most users.
313313
StacksEnabled *bool `jsonapi:"attr,stacks-enabled,omitempty"`
314+
315+
// Optional: DefaultProject is the default project that workspaces are created in when no project is specified.
316+
// This setting is considered BETA, SUBJECT TO CHANGE, and likely unavailable to most users.
317+
DefaultProject *Project `jsonapi:"relation,default-project,omitempty"`
314318
}
315319

316320
// ReadRunQueueOptions represents the options for showing the queue.

organization_integration_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,27 @@ func TestOrganizationsUpdate(t *testing.T) {
388388

389389
t.Cleanup(orgAgentTestCleanup)
390390
})
391+
392+
t.Run("with different default project", func(t *testing.T) {
393+
skipUnlessBeta(t)
394+
395+
// Create an organization and a second project in the organization
396+
org, orgCleanup := createOrganization(t, client)
397+
t.Cleanup(orgCleanup)
398+
399+
proj, _ := createProject(t, client, org) // skip cleanup because default project cannot be deleted
400+
401+
// Update the default project and verify the change
402+
updated, err := client.Organizations.Update(ctx, org.Name, OrganizationUpdateOptions{
403+
DefaultProject: proj,
404+
})
405+
require.NoError(t, err)
406+
require.Equal(t, proj.ID, updated.DefaultProject.ID)
407+
408+
fetched, err := client.Organizations.Read(ctx, org.Name)
409+
require.NoError(t, err)
410+
require.Equal(t, proj.ID, fetched.DefaultProject.ID)
411+
})
391412
}
392413

393414
func TestOrganizationsDelete(t *testing.T) {

0 commit comments

Comments
 (0)