feat: add github_copilot_organization_seat_assignment and github_copilot_team_seat_assignment resources#3462
Conversation
…lot_team_seat_assignment resources Closes integrations#1629 Adds two new resources for managing GitHub Copilot seat assignments when the organization has seat management set to "assign_selected": - github_copilot_organization_seat_assignment — assigns a Copilot seat to a specific org member via AddCopilotUsers / RemoveCopilotUsers - github_copilot_team_seat_assignment — assigns Copilot seats to all members of a team via AddCopilotTeams / RemoveCopilotTeams Read gracefully handles seats removed outside Terraform by removing the resource from state. Acceptance tests skip automatically when the org does not have seat management set to assign_selected.
|
👋 Hi, and thank you for this contribution! This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can. You can help us prioritize by joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions. 🤖 This is an automated message. |
…_assignment Add created_at, pending_cancellation_date, last_activity_at, last_activity_editor, and plan_type as computed attributes sourced from GetSeatDetails. Useful for auditing seat usage.
Exposes read-only Copilot billing settings for the provider org via
GET /orgs/{org}/copilot/billing: seat_management_setting,
public_code_suggestions, and the full seat_breakdown block.
The GitHub API has no write endpoint for these settings so a resource
is not possible — a data source is the correct primitive here.
Acceptance test verified against a real Copilot-enabled org.
Test results
Instructions to fully verify the seat assignment resourcesPrerequisites:
export TF_ACC=1
export GH_TEST_AUTH_MODE=organization
export GITHUB_OWNER=<your-org>
export GITHUB_USERNAME=<your-username>
export GITHUB_TOKEN=$(gh auth token) # or a PAT
export GH_TEST_ORG_USER=<an-org-member>
make testacc T=TestAccGithubCopilotExpected output when fully configured: If seat management is not set to |
040d60b to
e74f2c6
Compare
Closes #1629
Before the change?
There was no way to manage or inspect GitHub Copilot configuration via this provider. Organisations had to assign seats and check settings manually through the GitHub UI or call the API directly.
After the change?
Two new resources (require seat management set to
assign_selected):github_copilot_organization_seat_assignment— assigns a Copilot seat to a specific org member:Computed attributes:
created_at,pending_cancellation_date,last_activity_at,last_activity_editor,plan_type.github_copilot_team_seat_assignment— assigns Copilot seats to all members of a team:One new data source (works for any org with Copilot enabled, no
assign_selectedrequired):github_copilot_organization_settings— reads org-level Copilot billing settings:Attributes:
seat_management_setting,public_code_suggestions,seat_breakdown(total, active, pending, etc.).The data source exists because the GitHub API has no write endpoint for org Copilot settings — they can only be changed via the GitHub UI.
Known limitation — team Read performance: The GitHub API has no single-team Copilot seat lookup endpoint.
github_copilot_team_seat_assignmentRead paginates through all org seats to find the team entry. For large orgs with many Copilot seats this adds latency on everyplan/refresh. This is a GitHub API constraint — if a dedicated endpoint is added in future it can be adopted without a breaking change.Testing
github_copilot_organization_settingsdata source: acceptance test passes against a real Copilot-enabled org (nitin-sv)github_copilot_organization_seat_assignmentandgithub_copilot_team_seat_assignment: acceptance tests skip automatically when seat management is not set toassign_selected, with a clear messagePull request checklist
Does this introduce a breaking change?