Skip to content

Commit 303a2a8

Browse files
authored
Merge pull request #1078 from hashicorp/netramali/TF-24738-undo-ability-to-change-default-project
Remove ability to update default project
2 parents 6b4066b + 7ee28c0 commit 303a2a8

File tree

3 files changed

+4
-48
lines changed

3 files changed

+4
-48
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Unreleased
22

3+
## Enhancements
4+
5+
* Remove `DefaultProject` from `OrganizationUpdateOptions` to prevent updating an organization's default project, by @netramali [#1078](https://github.com/hashicorp/go-tfe/pull/1078)
6+
37
## BREAKING CHANGES
48

59
In the last release, Runs interface method `ListForOrganization` included pagination fields `TotalCount` and `TotalPages`, but these are being removed as this feature approaches general availablity by @brandonc [#1074](https://github.com/hashicorp/go-tfe/pull/1074)

organization.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88
"fmt"
99
"net/url"
1010
"time"
11-
12-
"github.com/hashicorp/jsonapi"
1311
)
1412

1513
// Compile-time proof of interface implementation.
@@ -313,10 +311,6 @@ type OrganizationUpdateOptions struct {
313311
// Optional: StacksEnabled toggles whether stacks are enabled for the organization. This setting
314312
// is considered BETA, SUBJECT TO CHANGE, and likely unavailable to most users.
315313
StacksEnabled *bool `jsonapi:"attr,stacks-enabled,omitempty"`
316-
317-
// Optional: DefaultProject is the default project that workspaces are created in when no project is specified.
318-
// This setting is considered BETA, SUBJECT TO CHANGE, and likely unavailable to most users.
319-
DefaultProject jsonapi.NullableRelationship[*Project] `jsonapi:"relation,default-project,omitempty"`
320314
}
321315

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

organization_integration_test.go

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"testing"
1111
"time"
1212

13-
"github.com/hashicorp/jsonapi"
1413
"github.com/stretchr/testify/assert"
1514
"github.com/stretchr/testify/require"
1615
)
@@ -389,47 +388,6 @@ func TestOrganizationsUpdate(t *testing.T) {
389388

390389
t.Cleanup(orgAgentTestCleanup)
391390
})
392-
393-
t.Run("with different default project", func(t *testing.T) {
394-
skipUnlessBeta(t)
395-
396-
// Create an organization and a second project in the organization
397-
org, orgCleanup := createOrganization(t, client)
398-
t.Cleanup(orgCleanup)
399-
400-
proj, _ := createProject(t, client, org) // skip cleanup because default project cannot be deleted
401-
402-
// Update the default project and verify the change
403-
updated, err := client.Organizations.Update(ctx, org.Name, OrganizationUpdateOptions{
404-
DefaultProject: jsonapi.NewNullableRelationshipWithValue[*Project](proj),
405-
})
406-
require.NoError(t, err)
407-
require.Equal(t, proj.ID, updated.DefaultProject.ID)
408-
409-
fetched, err := client.Organizations.Read(ctx, org.Name)
410-
require.NoError(t, err)
411-
require.Equal(t, proj.ID, fetched.DefaultProject.ID)
412-
413-
// Update without setting default project and verify no changes
414-
updated, err = client.Organizations.Update(ctx, org.Name, OrganizationUpdateOptions{})
415-
require.NoError(t, err)
416-
require.Equal(t, proj.ID, updated.DefaultProject.ID)
417-
418-
fetched, err = client.Organizations.Read(ctx, org.Name)
419-
require.NoError(t, err)
420-
require.Equal(t, proj.ID, fetched.DefaultProject.ID)
421-
422-
// Update the setting to an explicit null value and verify it is unset
423-
deleted, err := client.Organizations.Update(ctx, org.Name, OrganizationUpdateOptions{
424-
DefaultProject: jsonapi.NewNullNullableRelationship[*Project](),
425-
})
426-
require.NoError(t, err)
427-
require.Nil(t, deleted.DefaultProject)
428-
429-
fetched, err = client.Organizations.Read(ctx, org.Name)
430-
require.NoError(t, err)
431-
require.Nil(t, fetched.DefaultProject)
432-
})
433391
}
434392

435393
func TestOrganizationsDelete(t *testing.T) {

0 commit comments

Comments
 (0)