terraform-provider-github
terraform-provider-github copied to clipboard
[FEAT]: Organization Role Assignment
Describe the need
I may have missed something, but after a reasonably thorough scan of the docs I didn't see a resource for organization role assignment to a user or team.
The API endpoints I'm referring to are:
- https://docs.github.com/en/rest/orgs/organization-roles?apiVersion=2022-11-28#assign-an-organization-role-to-a-team
- https://docs.github.com/en/rest/orgs/organization-roles?apiVersion=2022-11-28#assign-an-organization-role-to-a-user
Implementation may look something like:
resource "github_organization_role_assignment" "example" {
role_id = 12345
username = "lukiffer"
}
resource "github_organization_role_assignment" "example" {
role_id = 12345
team_slug = "example-team"
}
It would be great to have these as a single resource that managed the different assignment principals, but if this isn't feasible having separate, explicitly-named resources are probably fine too.
SDK Version
No response
API Version
No response
Relevant log output
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
This would greatly simplify the management of access to repositories.
Adding 👍 for this too.
This is somewhat similar to #2314 which is implemented by #2322.
After review, this appears to have been implemented as part of #2487 which addresses #2314. @stevehipwell I see you worked that pull request, can you confirm on this one?
@nickfloyd this one may be able to be closed as already implemented. One change could be potentially combining the resources into a single resource like @lukiffer originally requested but it looks like the functionality is there for this now individually, which may be preferred.
@scottluskcis the PR has been merged so the functionality should be available.
@nickfloyd this one may be able to be closed as already implemented. One change could be potentially combining the resources into a single resource like @lukiffer originally requested but it looks like the functionality is there for this now individually, which may be preferred.
I wouldn't be against replacing github_organization_role_team & github_organization_role_user for github_organization_role_assignment with mutually exclusive inputs for either a team slug or a user login.
@scottluskcis @stevehipwell I'd be good with either way, though now changing it might technically be a breaking change - candidly I prefer the singleton approach, @stevehipwell reminded me of that last week, it just feels cleaner and more expressive. All that to say, with something as coupled as this, separating it for the sake of separating it might add unnecessary duplication and confusion.
I'll leave it in the capable hands here if anyone feels strongly about any given approach.
In #2487 github_organization_role_team was added, but isn't this the same as github_organization_role_team_assignment?
I think the github_organization_role_team_assignment resource needs deprecating.