Skip to content

feat: Refactor team data sources to latest pattern#3537

Open
stevehipwell wants to merge 7 commits into
integrations:mainfrom
stevehipwell:team-logic-refactor
Open

feat: Refactor team data sources to latest pattern#3537
stevehipwell wants to merge 7 commits into
integrations:mainfrom
stevehipwell:team-logic-refactor

Conversation

@stevehipwell

Copy link
Copy Markdown
Collaborator

Resolves #ISSUE_NUMBER


Before the change?

  • Team data sources weren't consistent and didn't use the latest patterns

After the change?

  • Refactored organization_repository_role data source
  • Refactored organization_repository_roles data source
    • Add id field to roles
    • Deprecate role_id field for roles
  • Refactored organization_role data source
  • Refactored organization_role_teams data source
    • Add id field to teams
    • Deprecate team-id field for teams
    • Add description, type, privacy, assignment & parent_team fields to roles
  • Refactored organization_role_users data source
    • Add assignment field to users
  • Refactored organization_roles data source
    • Add id field to roles
    • Deprecate role_id field for roles
  • Refactored organization_teams data source
    • Remove dependency on GraphQL API
    • Deprecate and ignore results_per_page
    • Add type, notification_setting, permission & parent_team fields to teams
    • Deprecate parent_team_id & parent_team_slug for teams
  • Refactored repository_teams data source
    • Deprecate full_name field for consistency (it's also not valid to query non-authenticated organization repositories for teams)
    • Added id, node_id, description, type, privacy & access_source fields to teams
  • Refactored team data source
    • Remove dependency on GraphQL API
    • Deprecate and ignore results_per_page
    • Add team_id, node_id, type & parent_team fields

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

@stevehipwell stevehipwell added this to the v6.14.0 milestone Jul 14, 2026
@stevehipwell stevehipwell requested a review from deiga July 14, 2026 11:57
@stevehipwell stevehipwell self-assigned this Jul 14, 2026
@stevehipwell stevehipwell added Type: Feature New feature or request Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR labels Jul 14, 2026
@github-actions

Copy link
Copy Markdown

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

@stevehipwell stevehipwell force-pushed the team-logic-refactor branch 2 times, most recently from 30fa261 to bea65b0 Compare July 14, 2026 12:10
@stevehipwell stevehipwell requested a review from Copilot July 14, 2026 15:04

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 modernizes team and organization-role data sources, replacing GraphQL paths, expanding schemas, and updating tests, examples, and generated documentation.

Changes:

  • Adds team, role, assignment, parent, and repository metadata.
  • Migrates API pagination and acceptance tests to current patterns.
  • Deprecates legacy fields and refreshes examples and documentation.

Reviewed changes

Copilot reviewed 45 out of 53 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
templates/data-sources/team.md.tmpl Modernizes team documentation template.
templates/data-sources/repository_teams.md.tmpl Updates repository-team schema template.
templates/data-sources/organization_teams.md.tmpl Updates organization-team documentation.
templates/data-sources/organization_roles.md.tmpl Documents expanded role fields.
templates/data-sources/organization_role.md.tmpl Adopts generated schema documentation.
templates/data-sources/organization_role_users.md.tmpl Documents user assignments.
templates/data-sources/organization_role_teams.md.tmpl Documents team assignments.
templates/data-sources/organization_repository_roles.md.tmpl Updates repository-role listing docs.
templates/data-sources/organization_repository_role.md.tmpl Updates repository-role lookup docs.
RESOURCES.md Marks refactored data sources complete.
github/util.go Adds diagnostic organization validation.
github/resource_github_repository_collaborators.go Reorders resource configuration.
github/data_source_github_team.go Refactors team lookup to REST.
github/data_source_github_team_test.go Reworks team acceptance coverage.
github/data_source_github_repository_teams.go Expands repository-team results.
github/data_source_github_repository_teams_test.go Tests expanded team metadata.
github/data_source_github_organization_teams.go Replaces GraphQL organization-team lookup.
github/data_source_github_organization_teams_test.go Covers team filtering and details.
github/data_source_github_organization_roles.go Adds role IDs and modernization.
github/data_source_github_organization_roles_test.go Tests organization-role listings.
github/data_source_github_organization_role.go Modernizes single-role lookup.
github/data_source_github_organization_role_users.go Adds user assignment metadata.
github/data_source_github_organization_role_users_test.go Tests direct and indirect users.
github/data_source_github_organization_role_test.go Modernizes role lookup tests.
github/data_source_github_organization_role_teams.go Adds detailed team assignments.
github/data_source_github_organization_role_teams_test.go Tests direct and inherited teams.
github/data_source_github_organization_repository_roles.go Adds repository-role IDs.
github/data_source_github_organization_repository_roles_test.go Modernizes role-list tests.
github/data_source_github_organization_repository_role.go Modernizes repository-role lookup.
github/data_source_github_organization_repository_role_test.go Updates repository-role tests.
github/acc_helpers_test.go Adds reusable acceptance helpers.
github/acc_checks_test.go Adds collection-absence assertion helper.
examples/data-sources/organization_teams/example_2.tf Removes legacy root-team example.
examples/data-sources/organization_teams/example_1.tf Removes legacy all-team example.
examples/data-sources/github_team/data-source_1.tf Adds current team example.
examples/data-sources/github_repository_teams/data-source_1.tf Adds repository-team example.
examples/data-sources/github_organization_teams/data-source_2.tf Adds root-team example.
examples/data-sources/github_organization_teams/data-source_1.tf Adds all-team example.
examples/data-sources/github_organization_roles/data-source_1.tf Adds role-list example.
examples/data-sources/github_organization_role/data-source_1.tf Adds role lookup example.
examples/data-sources/github_organization_role_users/data-source_1.tf Adds role-user example.
examples/data-sources/github_organization_role_teams/data-source_1.tf Adds role-team example.
examples/data-sources/github_organization_repository_roles/data-source_1.tf Adds repository-role list example.
examples/data-sources/github_organization_repository_role/data-source_1.tf Adds repository-role lookup example.
docs/data-sources/team.md Regenerates team documentation.
docs/data-sources/repository_teams.md Regenerates repository-team documentation.
docs/data-sources/organization_teams.md Regenerates organization-team documentation.
docs/data-sources/organization_roles.md Regenerates role-list documentation.
docs/data-sources/organization_role.md Regenerates role lookup documentation.
docs/data-sources/organization_role_users.md Regenerates role-user documentation.
docs/data-sources/organization_role_teams.md Regenerates role-team documentation.
docs/data-sources/organization_repository_roles.md Regenerates repository-role list documentation.
docs/data-sources/organization_repository_role.md Regenerates repository-role documentation.

Comment thread github/data_source_github_organization_teams.go Outdated
Comment thread github/data_source_github_repository_teams.go Outdated
Comment thread github/data_source_github_organization_teams.go
Comment thread github/data_source_github_organization_teams.go
Comment thread github/data_source_github_organization_roles.go
Comment thread github/data_source_github_organization_repository_roles.go
Comment thread github/data_source_github_team.go
Comment thread github/data_source_github_team.go
Comment thread templates/data-sources/organization_repository_role.md.tmpl
Comment thread templates/data-sources/organization_repository_roles.md.tmpl

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

Copilot reviewed 45 out of 53 changed files in this pull request and generated 7 comments.

Comment thread github/data_source_github_organization_role.go Outdated
Comment thread github/data_source_github_organization_repository_role.go Outdated
Comment thread github/data_source_github_team.go Outdated
Comment thread github/data_source_github_organization_role_users.go Outdated
Comment thread github/data_source_github_organization_role_teams.go Outdated
Comment thread templates/data-sources/team.md.tmpl Outdated
Comment thread docs/data-sources/team.md Outdated

@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.

Overall looks good, just 2 discussions that should be had :)

Comment thread github/acc_checks_test.go Outdated
Optional: true,
Computed: true,
ExactlyOneOf: []string{"full_name", "name"},
Deprecated: "The `full_name` attribute is deprecated and will be removed in a future version of the provider. Use `name` instead.",

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: we should agree on a pattern how we want to support configuring owner and name in the future. full_name currently enables that, but with it's removal the only option is to create multiple provider configs if there need to be multiple owners in the same TF config

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Given the current provider configuration full_name should never have been introduced for anything that requires authentication as it changes how the provider behaves based on auth method (user tokens can escape the clearly defined provider configured owner). It also should have been introduced as owner + name not as a single field overlapping with name.

For the v7 release I propose removing full_name and adding owner for data sources that should work unauthenticated. For authenticated data sources or resources full_name should be removed and the pattern would be to use multip0le provider instanves. This gives us consistency and a better platform to implement a multi owner pattern on top of (for v8 maybe?).

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.

Sounds reasonable, though for multi-provider instances we need to improve the Environment variable logic, currently auth Environment variables override configured logic to some extent.
And it's currently not possible to have 2 different GH Apps using ENV for different providers

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

Copilot reviewed 45 out of 53 changed files in this pull request and generated 3 comments.

Comment thread github/data_source_github_team_test.go
Comment thread github/data_source_github_organization_teams.go
Comment thread github/data_source_github_organization_teams.go Outdated

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

Copilot reviewed 45 out of 53 changed files in this pull request and generated 3 comments.

Comment thread github/data_source_github_organization_teams.go
Comment thread github/data_source_github_team.go
Comment thread github/data_source_github_organization_role_teams.go Outdated

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

Copilot reviewed 45 out of 53 changed files in this pull request and generated 7 comments.

Comment thread github/data_source_github_team.go
Comment thread github/acc_helpers_test.go Outdated
Comment thread github/data_source_github_team_test.go
Comment thread github/data_source_github_organization_teams_test.go
Comment thread github/data_source_github_repository_teams.go Outdated
Comment thread templates/data-sources/repository_teams.md.tmpl Outdated
Comment thread docs/data-sources/repository_teams.md Outdated

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

Copilot reviewed 45 out of 53 changed files in this pull request and generated 1 comment.

Comment thread github/data_source_github_team.go

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

Copilot reviewed 45 out of 53 changed files in this pull request and generated 1 comment.

Comment thread github/data_source_github_repository_teams_test.go

@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.

Looking good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New feature or request Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants