From 4d7eeec0cebf4c6a15c865891a00594905d8fcca Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Tue, 27 Aug 2024 10:41:14 -0700 Subject: [PATCH 1/4] Org: Include no-code specific permissions to `OrganizationPermissions` Prior to this commit, the organization permissions struct left out a couple of permissions around the no-code provisioning feature: - https://developer.hashicorp.com/terraform/tutorials/cloud/no-code-provisioning This commit includes those permissions, which are already being returned by the TF API, into the `OrganizationPermissions` struct. Fixes WAYP-2963 TF-19913 --- organization.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/organization.go b/organization.go index 040e2027d..78813a387 100644 --- a/organization.go +++ b/organization.go @@ -183,7 +183,9 @@ type OrganizationPermissions struct { CanCreateTeam bool `jsonapi:"attr,can-create-team"` CanCreateWorkspace bool `jsonapi:"attr,can-create-workspace"` CanCreateWorkspaceMigration bool `jsonapi:"attr,can-create-workspace-migration"` + CanDeployNoCodeModules bool `jsonapi:"attr,can-deploy-no-code-modules"` CanDestroy bool `jsonapi:"attr,can-destroy"` + CanManageNoCodeModules bool `jsonapi:"attr,can-manage-no-code-modules"` CanManageRunTasks bool `jsonapi:"attr,can-manage-run-tasks"` CanTraverse bool `jsonapi:"attr,can-traverse"` CanUpdate bool `jsonapi:"attr,can-update"` From cfee3d89271dce40b11a94c7d9031a87fefeda0f Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Tue, 27 Aug 2024 12:04:24 -0700 Subject: [PATCH 2/4] Fixup: Add changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3164c455e..3ead3d59e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# UNRELEASED + +## Enhancements + +* Adds support for including no-code permissions to the `OrganizationPermissions` struct [#967](https://github.com/hashicorp/go-tfe/pull/967) + # v1.64.1 # Bug Fixes From 2763cc26c0a4ac54a66e44285b6091913b333ddc Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Tue, 27 Aug 2024 12:09:26 -0700 Subject: [PATCH 3/4] Test: Add test for asserting no-code permissions for org --- organization_integration_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/organization_integration_test.go b/organization_integration_test.go index 53e4dd1ac..0c57f4c90 100644 --- a/organization_integration_test.go +++ b/organization_integration_test.go @@ -151,6 +151,30 @@ func TestOrganizationsCreate(t *testing.T) { }) } +func TestOrganizationsReadWithBusiness(t *testing.T) { + client := testClient(t) + ctx := context.Background() + + orgTest, orgTestCleanup := createOrganization(t, client) + t.Cleanup(orgTestCleanup) + // With Business + newSubscriptionUpdater(orgTest).WithBusinessPlan().Update(t) + + t.Run("when the org exists", func(t *testing.T) { + org, err := client.Organizations.Read(ctx, orgTest.Name) + require.NoError(t, err) + assert.Equal(t, orgTest.Name, org.Name) + assert.Equal(t, orgTest.ExternalID, org.ExternalID) + assert.NotEmpty(t, org.Permissions) + + t.Run("permissions are properly decoded", func(t *testing.T) { + assert.True(t, org.Permissions.CanDestroy) + assert.True(t, org.Permissions.CanDeployNoCodeModules) + assert.True(t, org.Permissions.CanManageNoCodeModules) + }) + }) +} + func TestOrganizationsRead(t *testing.T) { client := testClient(t) ctx := context.Background() From e75d2b5be97cdbbaac57cd6d46236a1ee67d0a89 Mon Sep 17 00:00:00 2001 From: UKEME BASSEY Date: Tue, 27 Aug 2024 18:33:18 -0400 Subject: [PATCH 4/4] Update CHANGELOG.md for release v1.64.2 (#968) --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ead3d59e..9ff5ada5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,14 @@ # UNRELEASED +# v1.64.2 + ## Enhancements * Adds support for including no-code permissions to the `OrganizationPermissions` struct [#967](https://github.com/hashicorp/go-tfe/pull/967) # v1.64.1 -# Bug Fixes +## Bug Fixes * Fixes BETA feature regression in `Stacks` associated with decoding `StackVCSRepo` data by @brandonc [#964](https://github.com/hashicorp/go-tfe/pull/964)