Skip to content

[FEAT]: Support filter parameter on github_organization_team_sync_groups data source #1809

Open

Description

@janslow

Describe the need

Currently, the github_organization_team_sync_groups data source fetches all groups (in fixed page sizes of 100). This causes performance issues if a large number of groups are synced into GitHub (we have about 3000 groups being pushed to GitHub, so the refresh of github_organization_team_sync_groups takes 20+ seconds).

As a feature request, please expose the q query parameter, to allow the data source to be scoped to a subset of all groups:

Filters the results to return only those that begin with the value specified by this parameter. For example, a value of ab will return results that begin with "ab".

For example,

data "github_organization_team_sync_groups" "filtered" {
  q = "myprefix_"
}

SDK Version

No response

API Version

REST API 2022-11-28 (Enterprise Cloud)

Relevant log output

No response

Code of Conduct

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

Activity

  1. added
    Status: Triage
    Type: Feature
    on Jul 24, 2023
  2. added
    Status: Up for grabs
    and removed
    Status: Triage
    on Jul 24, 2023
  3. moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Activeon Jul 24, 2023
  4. cardoe commented on Sep 14, 2023

    @cardoe

    Could this be related to #560?

  5. janslow commented on Sep 14, 2023

    @janslow
    Author

    Could this be related to #560?

    Not as far as I can see.

    The #560 issue seems to be related to a server error from the Github API, so probably can't be solved by a change in the Terraform provide

    This issue is a request to expose an existing feature of the Github API via the provider

    There doesn't seem to be any overlapping symptoms between the two

  6. added
    hacktoberfest
    on Sep 21, 2023
  7. github-actions commented on Jun 20, 2024

    @github-actions

    👋 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!

  8. added
    Status: Stale
    on Jun 20, 2024
  9. moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Activeon Jun 28, 2024
  10. laughedelic commented on Jul 2, 2024

    @laughedelic
    Contributor

    This is still very much relevant. Can we reopen it?
    The data source in the current state is not usable when the IdP has thousands of groups, it should be possible to filter the groups by id or name.

  11. 2 remaining items

  12. added
    Status: Pinned
    on Jul 3, 2024
  13. laughedelic commented on Jul 5, 2024

    @laughedelic
    Contributor

    This is a limitation of the go-github library, so I opened a request upstream: google/go-github#3196 / google/go-github#3197

  14. laughedelic commented on Jul 23, 2024

    @laughedelic
    Contributor

    Since fixing this properly takes a long time, here is my workaround using the github_rest_api data source:

    data "github_rest_api" "team_sync_groups" {
      endpoint = "orgs/ORG/team-sync/groups?q=your%20prefix"
    }
    
    locals {
      # index IdP groups by group name:
      idp_sync_groups_lookup = { for group in jsondecode(data.github_rest_api.team_sync_groups.body).groups : group.group_name => group }
    }

    Then you can do local.idp_sync_groups_lookup["your prefix group name"] to get the group data.

    Note that if you have spaces or any other non-URL symbols in the prefix, you need to url-encode them.


    Update: this might be only a partial workaround, because this data source doesn't seem to do auto-pagination. The endpoint returns 30 results per page by default, so if you expect more, you can add &per_page=100 at the end.

  15. fatbasstard commented on Feb 3, 2025

    @fatbasstard
    Contributor

    @laughedelic Since your upstream PR's are merged a long time ago already, any chance we can get this in here. Not sure who to poke exactly so going with you ;)

  16. laughedelic commented on Feb 3, 2025

    @laughedelic
    Contributor

    Hi @fatbasstard. Initially, I waited for the upstream library version update. Now it looks like the currently used version (66) includes those changes. So it shouldn't be a problem. I don't have time to contribute this change here though

  17. moved this from Backlog to In Progress in Terraform Provideron Mar 2, 2026
  18. removed
    Status: Up for grabs
    Good first issue
    hacktoberfest
    on May 22, 2026
  19. added and removed
    Status: Pinned
    on Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions