Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions internal/provider/resource_tfe_admin_organization_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func resourceTFEAdminOrganizationSettings() *schema.Resource {
Type: schema.TypeBool,
Optional: true,
},
"global_provider_sharing": {
Type: schema.TypeBool,
Optional: true,
},
"sso_enabled": {
Computed: true,
Type: schema.TypeBool,
Expand Down Expand Up @@ -87,6 +91,7 @@ func resourceTFEAdminOrganizationSettingsRead(d *schema.ResourceData, meta inter
d.Set("organization", org.Name)
d.Set("access_beta_tools", org.AccessBetaTools)
d.Set("global_module_sharing", org.GlobalModuleSharing)
d.Set("global_provider_sharing", org.GlobalProviderSharing)
d.Set("sso_enabled", org.SsoEnabled)
d.Set("workspace_limit", org.WorkspaceLimit)
d.SetId(org.Name)
Expand Down Expand Up @@ -140,11 +145,13 @@ func resourceTFEAdminOrganizationSettingsUpdate(d *schema.ResourceData, meta int
return err
}
globalModuleSharing := d.Get("global_module_sharing").(bool)
globalProviderSharing := d.Get("global_provider_sharing").(bool)

_, err = config.Client.Admin.Organizations.Update(ctx, name, tfe.AdminOrganizationUpdateOptions{
AccessBetaTools: tfe.Bool(d.Get("access_beta_tools").(bool)),
GlobalModuleSharing: tfe.Bool(globalModuleSharing),
WorkspaceLimit: tfe.Int(d.Get("workspace_limit").(int)),
AccessBetaTools: tfe.Bool(d.Get("access_beta_tools").(bool)),
GlobalModuleSharing: tfe.Bool(globalModuleSharing),
GlobalProviderSharing: tfe.Bool(globalProviderSharing),
WorkspaceLimit: tfe.Int(d.Get("workspace_limit").(int)),
})

if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ func TestAccTFEAdminOrganizationSettings_basic(t *testing.T) {
"tfe_admin_organization_settings.settings", "organization", fmt.Sprintf("tst-terraform-%d", rInt1)),
resource.TestCheckResourceAttr(
"tfe_admin_organization_settings.settings", "global_module_sharing", "false"),
resource.TestCheckResourceAttr(
"tfe_admin_organization_settings.settings", "global_provider_sharing", "false"),
resource.TestCheckResourceAttr(
"tfe_admin_organization_settings.settings", "access_beta_tools", "true"),

Expand All @@ -58,6 +60,8 @@ func TestAccTFEAdminOrganizationSettings_basic(t *testing.T) {
"tfe_admin_organization_settings.settings", "organization", fmt.Sprintf("tst-terraform-%d", rInt1)),
resource.TestCheckResourceAttr(
"tfe_admin_organization_settings.settings", "global_module_sharing", "false"),
resource.TestCheckResourceAttr(
"tfe_admin_organization_settings.settings", "global_provider_sharing", "false"),
resource.TestCheckResourceAttr(
"tfe_admin_organization_settings.settings", "access_beta_tools", "true"),

Expand Down Expand Up @@ -94,6 +98,7 @@ resource "tfe_organization" "bar" {
resource "tfe_admin_organization_settings" "settings" {
organization = tfe_organization.foobar.id
global_module_sharing = false
global_provider_sharing = false
access_beta_tools = true

module_sharing_consumer_organizations = [tfe_organization.foo.id, tfe_organization.bar.id]
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/admin_organization_settings.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ resource "tfe_admin_organization_settings" "test-settings" {
workspace_limit = 15
access_beta_tools = false
global_module_sharing = false
global_provider_sharing = false
module_sharing_consumer_organizations = [
tfe_organization.a-module-consumer.name
]
Expand All @@ -58,6 +59,7 @@ The following arguments are supported:
* `access_beta_tools` - (Optional) True if the organization has access to beta tool versions.
* `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.
* `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.
* `global_provider_sharing` - (Optional) If true, provider in the organization's private provider registry will be available to all other organizations.
* `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.

## Attributes Reference
Expand Down