integrations / integrations/terraform-provider-github
[FEAT]: Get available seats from `github_organization` data source
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 8
Description
### Describe the need
Currently when managing organization membership with this provider, there is no way to detect when the org's seats are full when running `terraform plan`, but later `terraform apply` will fail with `You must purchase at least one more seat to add this user as a member. [{Resource: Field:user Code:no_seat Message:}]`, requiring an organization/enterprise owner to manually add seats before rerunning the apply.
Since the `GET /orgs/{org}` endpoint of GitHub REST API already returns the available seats (`seats`) and current filled seats (`filled_seats`) in the `plan` struct, as documented [here](https://docs.github.com/en/rest/orgs/orgs?apiVersion=2026-03-10#get-an-organization), we can expose them to the `github_organization` data source as attributes, and let users be able to check them with precondition.
### GitHub Installation Type
- [x] GitHub.com (Free, Pro, or Team)
- [x] GitHub Enterprise Server (on-premises)
- [x] GitHub Enterprise Cloud with Personal Accounts (github.com)
- [x] GitHub Enterprise Cloud with Managed Users/EMU (github.com)
- [x] GitHub Enterprise Cloud with Data Residency (*.ghe.com)
- [ ] I don't know
### Relevant log output
```shell
* Failed to execute "terraform apply -auto-approve -input=false -lock-timeout=300s -no-color" in ./.terragrunt-cache.../members
Error: PUT https://api.github.com/orgs/my-org/memberships/skywalker: 422 You must purchase at least one more seat to add this user as a member. [{Resource: Field:user Code:no_seat Message:}]
with github_membership.membership["skywalker"],
on members.tf line 1, in resource "github_membership" "membership":
1: resource "github_membership" "membership" {
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.