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

Manage Github organization #872

Closed
Olin-Vorechovsky opened this issue Aug 4, 2021 · 3 comments · Fixed by #1669
Closed

Manage Github organization #872

Olin-Vorechovsky opened this issue Aug 4, 2021 · 3 comments · Fixed by #1669
Labels
Status: Blocked Some technical or requirement is blocking the issue Type: Feature New feature or request

Comments

@Olin-Vorechovsky
Copy link

Hi there,

I would like to manage Github organizations (creating, updating, deleting) by terraform.

I have created resource_github_organization resource to create/rename organization by terraform.

Here is GitHub API docs: https://docs.github.com/en/[email protected]/rest/reference/enterprise-admin
It needs Enterprise Account with site_admin scope (in oposit of organization account used for most cases) making acceptance testing harder b/c this api is not available for public Github but only for Github Enterprise (GHE).

Terraform Version

Terraform v1.0.1

Affected Resource(s)

  • resource_github_organization

Terraform Configuration Files

provider "github" {
  base_url = "https://enterprise.github.com/"
  // you don't need owner property here
}

resource "github_organization" "test" {
  login = "organization-name"
  // you need exported GITHUB_TOKEN Personal Token with site_admin scope of this user
  admin = "admin"
  // TODO: not set on creation
  // profile_name = "short name"
}

Debug Output for creation

github_organization. test: Creating...
github_organization. test: Creation complete after 1s [id=2600]

Debug output for updating (renaming only)

 # github_organization.create_new will be updated in-place
  ~ resource "github_organization" "test
        id           = "2600"
      + profile_name = "short name"
        # (2 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

github_organization.create_new: Modifying... [id=2600]
github_organization.create_new: Modifications complete after 1s [id=2600

Actual Behavior

It works.

Important Factoids

  • unable to pass test b/c it needs to be run agains GHE
  • to fully suport updating organization we need to add more than profile_name and we need to call different api than enterprise endpoints
  • cannot find api for organization delete

References

Kick-off sources: #864

@github-actions
Copy link

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Status: Stale Used by stalebot to clean house label Nov 30, 2022
@kfcampbell
Copy link
Member

This is unfortunately limited by API support at the moment. We can't create or delete orgs from the API. Reference here.

@kfcampbell kfcampbell added Type: Feature New feature or request Priority: Normal Status: Blocked Some technical or requirement is blocking the issue labels Dec 1, 2022
@github-actions github-actions bot removed the Status: Stale Used by stalebot to clean house label Dec 2, 2022
@tjcorr
Copy link
Contributor

tjcorr commented Apr 26, 2023

Looks like this was initially added with #1478 to create/update organizations. #1669 will add delete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Blocked Some technical or requirement is blocking the issue Type: Feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants