Skip to content

feat: Add github_team_external_groups data source#3296

Open
orirawlings wants to merge 1 commit into
integrations:mainfrom
orirawlings:team_external_groups
Open

feat: Add github_team_external_groups data source#3296
orirawlings wants to merge 1 commit into
integrations:mainfrom
orirawlings:team_external_groups

Conversation

@orirawlings

Copy link
Copy Markdown

Resolves #3295


Before the change?

  • No support for reading external groups by organization team.

After the change?

  • Add github_team_external_groups data source for loading the external groups mapped to a given team.

Pull request checklist

  • Schema migrations have been created if needed (example)
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@deiga deiga added Type: Feature New feature or request New data source labels Mar 25, 2026

@deiga deiga left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!
Partial review, left a few change requests :)

Comment thread github/data_source_github_team_external_groups.go
Comment thread github/data_source_github_team_external_groups.go Outdated
Comment thread github/data_source_github_team_external_groups_test.go Outdated
Comment thread github/data_source_github_team_external_groups_test.go Outdated
@orirawlings orirawlings force-pushed the team_external_groups branch 2 times, most recently from c0057e8 to b5ae884 Compare March 27, 2026 22:48
@orirawlings

Copy link
Copy Markdown
Author

Thank you very much for the partial review @deiga! I went ahead and addressed the feedback. Let me know if anything looks off. This is my first time working on terraform provider code so I'm still ramping up on the testing framework/approach.

Cheers

Comment on lines +32 to +36
___

* `group_id` - The ID of the external group.
* `group_name` - The name of the external group.
* `updated_at` - The date the group was last updated.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This doesn't follow the pattern in the docs, please adjust

@orirawlings orirawlings Mar 30, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you prefer the subfields to be a nested list under external_groups? The current patch is replicating the pattern used in website/docs/d/external_groups.html.markdown. Should I include a commit to update to use a nested list there as well?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deiga Thanks for another round of review.

I went ahead and pushed an update to both pages to use a nested list. I also realized I missed adding a link to the new page in website/github.erb, so I added that as well.

@orirawlings orirawlings force-pushed the team_external_groups branch from b5ae884 to 27f3db1 Compare March 30, 2026 15:33
deiga
deiga previously approved these changes Apr 1, 2026
@orirawlings

Copy link
Copy Markdown
Author

Thank you for the review and approval @deiga!

@orirawlings orirawlings force-pushed the team_external_groups branch from 27f3db1 to 27f6f31 Compare April 13, 2026 22:11
@deiga deiga added this to the v6.13.0 Release milestone Apr 14, 2026
@deiga deiga removed this from the v6.13.0 milestone Jun 3, 2026
@orirawlings

Copy link
Copy Markdown
Author

I don't mean to be rude or to put any undue pressure, but I was curious if there was any estimate for when this might land? We're getting close to shipping a project that depends on this. I just need to decide if we need to organize around an internal fork or if we can use upstream directly.

@deiga

deiga commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

@orirawlings sorry, we can't promise an ETA for this. We're only community maintainers here and using our free time for this hobby.

I wouldn't recommend using your own fork just for a data source, since you can use the rest_api data source as a temporary patch.

While waiting for us, it would be very helpful if you can keep the PR rebased and with passing test/lint/docs checks 😊

That way we don't have to try and hunt you down once we have capacity for this

@orirawlings

Copy link
Copy Markdown
Author

Will do. Thanks @deiga!

@orirawlings orirawlings force-pushed the team_external_groups branch 2 times, most recently from 5cfa313 to 8aff54d Compare June 19, 2026 19:29
@orirawlings orirawlings force-pushed the team_external_groups branch from 8aff54d to 74e67b0 Compare June 19, 2026 19:39
@orirawlings

orirawlings commented Jun 19, 2026

Copy link
Copy Markdown
Author

Thanks for your help so far on this @deiga.

I've resolved the errors on make lintcheck-new checkdocs validatedocs locally now and the new acceptance test is working locally against a test organization (make testacc T=TestAccGithubTeamExternalGroupsDataSource GITHUB_OWNER=<myTestOrg> GH_TEST_AUTH_MODE=organization GITHUB_TOKEN="$(gh auth token)"). So I'm hoping this passes now on the ci workflow.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

These provider review instructions are being used.

This PR adds a new read-only data source, github_team_external_groups, which lists the external (IdP) groups mapped to a single organization team via the GitHub REST endpoint GET /orgs/{org}/teams/{team_slug}/external-groups (go-github Teams.ListExternalGroupsForTeamBySlug). It complements the existing org-wide github_external_groups data source and resolves #3295. The implementation closely mirrors github_external_groups, registering the data source in the provider and exposing the same group_id/group_name/updated_at output shape, keyed by the team slug.

Changes:

  • New github_team_external_groups data source (schema + read logic) returning a team's external groups.
  • Provider registration and generated docs for the new data source.
  • Acceptance tests covering the not-found error path and the empty-list path.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
github/provider.go Registers the new github_team_external_groups data source.
github/data_source_github_team_external_groups.go Implements the schema and read function; nested attributes lack Description.
github/data_source_github_team_external_groups_test.go Adds acceptance tests; PreCheck guard (skipUnlessHasOrgs) is likely too weak for EMU-only external groups.
docs/data-sources/team_external_groups.md Generated docs; lacks an Example Usage section because no example file was added.

Residual risk: The "returns empty list" acceptance test depends on GitHub returning an empty list (rather than an error) for a non-externally-managed team; this could not be fully verified and may behave differently outside an EMU enterprise.

Comment on lines +21 to +40
"external_groups": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"group_id": {
Type: schema.TypeInt,
Computed: true,
},
"group_name": {
Type: schema.TypeString,
Computed: true,
},
"updated_at": {
Type: schema.TypeString,
Computed: true,
},
},
},
},
Comment on lines +11 to +14
func dataSourceGithubTeamExternalGroups() *schema.Resource {
return &schema.Resource{
Description: "Retrieve external groups for a specific GitHub team.",
ReadContext: dataSourceGithubTeamExternalGroupsRead,
`, teamName)

resource.Test(t, resource.TestCase{
PreCheck: func() { skipUnlessHasOrgs(t) },
`

resource.Test(t, resource.TestCase{
PreCheck: func() { skipUnlessHasOrgs(t) },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New data source Type: Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Add data source support for the External Groups of a Team

3 participants