Skip to content

Commit 5a2cec3

Browse files
danilobuergerctrombley
authored andcommitted
Added global_provider_sharing to tfe_admin_organization_settings
See https://developer.hashicorp.com/terraform/enterprise/application-administration/registry-sharing
1 parent 07ee06e commit 5a2cec3

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

internal/provider/resource_tfe_admin_organization_settings.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ func resourceTFEAdminOrganizationSettings() *schema.Resource {
4141
Type: schema.TypeBool,
4242
Optional: true,
4343
},
44+
"global_provider_sharing": {
45+
Type: schema.TypeBool,
46+
Optional: true,
47+
},
4448
"sso_enabled": {
4549
Computed: true,
4650
Type: schema.TypeBool,
@@ -87,6 +91,7 @@ func resourceTFEAdminOrganizationSettingsRead(d *schema.ResourceData, meta inter
8791
d.Set("organization", org.Name)
8892
d.Set("access_beta_tools", org.AccessBetaTools)
8993
d.Set("global_module_sharing", org.GlobalModuleSharing)
94+
d.Set("global_provider_sharing", org.GlobalProviderSharing)
9095
d.Set("sso_enabled", org.SsoEnabled)
9196
d.Set("workspace_limit", org.WorkspaceLimit)
9297
d.SetId(org.Name)
@@ -140,11 +145,13 @@ func resourceTFEAdminOrganizationSettingsUpdate(d *schema.ResourceData, meta int
140145
return err
141146
}
142147
globalModuleSharing := d.Get("global_module_sharing").(bool)
148+
globalProviderSharing := d.Get("global_provider_sharing").(bool)
143149

144150
_, err = config.Client.Admin.Organizations.Update(ctx, name, tfe.AdminOrganizationUpdateOptions{
145-
AccessBetaTools: tfe.Bool(d.Get("access_beta_tools").(bool)),
146-
GlobalModuleSharing: tfe.Bool(globalModuleSharing),
147-
WorkspaceLimit: tfe.Int(d.Get("workspace_limit").(int)),
151+
AccessBetaTools: tfe.Bool(d.Get("access_beta_tools").(bool)),
152+
GlobalModuleSharing: tfe.Bool(globalModuleSharing),
153+
GlobalProviderSharing: tfe.Bool(globalProviderSharing),
154+
WorkspaceLimit: tfe.Int(d.Get("workspace_limit").(int)),
148155
})
149156

150157
if err != nil {

internal/provider/resource_tfe_admin_organization_settings_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ func TestAccTFEAdminOrganizationSettings_basic(t *testing.T) {
3333
"tfe_admin_organization_settings.settings", "organization", fmt.Sprintf("tst-terraform-%d", rInt1)),
3434
resource.TestCheckResourceAttr(
3535
"tfe_admin_organization_settings.settings", "global_module_sharing", "false"),
36+
resource.TestCheckResourceAttr(
37+
"tfe_admin_organization_settings.settings", "global_provider_sharing", "false"),
3638
resource.TestCheckResourceAttr(
3739
"tfe_admin_organization_settings.settings", "access_beta_tools", "true"),
3840

@@ -58,6 +60,8 @@ func TestAccTFEAdminOrganizationSettings_basic(t *testing.T) {
5860
"tfe_admin_organization_settings.settings", "organization", fmt.Sprintf("tst-terraform-%d", rInt1)),
5961
resource.TestCheckResourceAttr(
6062
"tfe_admin_organization_settings.settings", "global_module_sharing", "false"),
63+
resource.TestCheckResourceAttr(
64+
"tfe_admin_organization_settings.settings", "global_provider_sharing", "false"),
6165
resource.TestCheckResourceAttr(
6266
"tfe_admin_organization_settings.settings", "access_beta_tools", "true"),
6367

@@ -94,6 +98,7 @@ resource "tfe_organization" "bar" {
9498
resource "tfe_admin_organization_settings" "settings" {
9599
organization = tfe_organization.foobar.id
96100
global_module_sharing = false
101+
global_provider_sharing = false
97102
access_beta_tools = true
98103
99104
module_sharing_consumer_organizations = [tfe_organization.foo.id, tfe_organization.bar.id]

website/docs/r/admin_organization_settings.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ resource "tfe_admin_organization_settings" "test-settings" {
4444
workspace_limit = 15
4545
access_beta_tools = false
4646
global_module_sharing = false
47+
global_provider_sharing = false
4748
module_sharing_consumer_organizations = [
4849
tfe_organization.a-module-consumer.name
4950
]
@@ -58,6 +59,7 @@ The following arguments are supported:
5859
* `access_beta_tools` - (Optional) True if the organization has access to beta tool versions.
5960
* `workspace_limit` - (Optional) Maximum number of workspaces for this organization. If this number is set to a value lower than the number of workspaces the organization has, it will prevent additional workspaces from being created, but existing workspaces will not be affected. If set to 0, this limit will have no effect.
6061
* `global_module_sharing` - (Optional) If true, modules in the organization's private module repository will be available to all other organizations. Enabling this will disable any previously configured module_sharing_consumer_organizations. Cannot be true if module_sharing_consumer_organizations is set.
62+
* `global_provider_sharing` - (Optional) If true, provider in the organization's private provider registry will be available to all other organizations.
6163
* `module_sharing_consumer_organizations` - (Optional) A list of organization names to share modules in the organization's private module repository with. Cannot be set if global_module_sharing is true.
6264

6365
## Attributes Reference

0 commit comments

Comments
 (0)