Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New resource: tfe_admin_organization_settings #709

Merged
merged 5 commits into from
Dec 6, 2022

Conversation

brandonc
Copy link
Collaborator

@brandonc brandonc commented Dec 5, 2022

Description

We've sometimes needed a way to manage admin-scope settings for organizations, but couldn't add those arguments to tfe_organization, as it would require an admin token. This separate resource (TFE Only) can manage both module consumers and the global_module_sharing setting simultaneously, which was raise in #515

Testing plan

  1. Try some variations on this config:
provider "tfe" {
  token = "NORMAL_TOKEN"
}

provider "tfe" {
  alias = "admin"
  token = "ADMIN_TOKEN"
}

resource "tfe_organization" "foo" {
	name = "tst-terraform-1"
	email = "[email protected]"
}

resource "tfe_organization" "bar" {
	name = "tst-terraform-2"
	email = "[email protected]"
}

resource "tfe_admin_organization_settings" "foo-settings" {
  provider = tfe.admin
  organization = tfe_organization.foo.name
  access_beta_tools = false
  workspace_limit = 15
  global_module_sharing = false
  module_sharing_consumer_org_names = [
    tfe_organization.bar.name
  ]
}

External links

Documentation Screenshot

Screenshot 2022-12-05 at 14-28-54 Doc Preview Tool Terraform Registry

Output from acceptance tests

$ ENABLE_TFE=1 TESTARGS="-run TestAccTFEAdminOrganizationSettings" make testacc
TF_ACC=1 TF_LOG_SDK_PROTO=OFF go test $(go list ./... |grep -v 'vendor') -v -run TestAccTFEAdminOrganizationSettings -timeout 15m
?   	github.com/hashicorp/terraform-provider-tfe	[no test files]
=== RUN   TestAccTFEAdminOrganizationSettings_basic
--- PASS: TestAccTFEAdminOrganizationSettings_basic (30.76s)
PASS
ok  	github.com/hashicorp/terraform-provider-tfe/tfe	31.540s
?   	github.com/hashicorp/terraform-provider-tfe/version	[no test files]

@brandonc brandonc requested a review from a team as a code owner December 5, 2022 21:37
@brandonc brandonc linked an issue Dec 5, 2022 that may be closed by this pull request
@brandonc brandonc force-pushed the brandonc/admin_org_settings_sdk branch from 56163f8 to e0ec06e Compare December 5, 2022 21:50
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@annawinkler
Copy link
Contributor

💅 Small suggestion to update the example in the PR description to reference the new module_sharing_consumer_organizations

Copy link
Contributor

@sebasslash sebasslash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good to me, barring @annawinkler 's feedback. I smoke tested ✔️

tfe/resource_tfe_admin_organization_settings.go Outdated Show resolved Hide resolved
Copy link
Contributor

@annawinkler annawinkler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm testing locally and getting an auth error. Maybe we could pair and see what's going on? I'll DM you directly. Thanks!

Copy link
Contributor

@annawinkler annawinkler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chatted & retested & it works locally! :shipit:

@brandonc brandonc force-pushed the brandonc/admin_org_settings_sdk branch from 56ec443 to 2831aaa Compare December 6, 2022 14:58
@brandonc brandonc merged commit e5c2e62 into main Dec 6, 2022
@brandonc brandonc deleted the brandonc/admin_org_settings_sdk branch December 6, 2022 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tfe_organization_module_sharing can share with all organizations
3 participants