terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

[FEAT]: add support for pre-defined organization roles

Open mkushakov opened this issue 1 year ago • 4 comments

Describe the need

As announced https://github.blog/changelog/2024-07-10-pre-defined-organization-roles-that-grant-access-to-all-repositories/ Github has added support for pre-defined organisation roles. To add new resource like github_team_organization_role similar to github_team_repository to assign team to pre-defined role.

resource "github_team" "some_team" {
  name        = "SomeTeam"
  description = "Some cool team"
}

resource "github_team_organization_role" "some_team_role" {
  team_id    = github_team.some_team.slug
  role = "all_repo_read"
}

API:

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

mkushakov avatar Jul 11 '24 06:07 mkushakov

Workaround is to use REST API provider

resource "restapi_object" "global_permissions" {
  for_each = var.global_permissions

  path = "/orgs/${var.organization_name}/organization-roles"

  object_id = local.global_permissions[each.value.permission]

  create_path  = "/orgs/${var.organization_name}/organization-roles/teams/${each.key}/{id}"
  update_path  = "/orgs/${var.organization_name}/organization-roles/teams/${each.key}/{id}"
  destroy_path = "/orgs/${var.organization_name}/organization-roles/teams/${each.key}/{id}"

  create_method = "PUT"

  data = jsonencode({})
}

akmalharith avatar Sep 06 '24 03:09 akmalharith

👋 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[bot] avatar Jun 04 '25 02:06 github-actions[bot]

Not stale

martinssipenko avatar Jun 04 '25 05:06 martinssipenko

Any update on this?

Bradley-McCallion avatar Jun 09 '25 08:06 Bradley-McCallion

This issue is not stale. The suggested solution with mastercard/restapi is working, but the provider is not gpg signed.

jay-dizzale avatar Jul 08 '25 12:07 jay-dizzale