feat: Refactor team data sources to latest pattern#3537
Conversation
|
👋 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. |
30fa261 to
bea65b0
Compare
There was a problem hiding this comment.
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. |
bea65b0 to
35511b6
Compare
deiga
left a comment
There was a problem hiding this comment.
Overall looks good, just 2 discussions that should be had :)
| 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.", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?).
There was a problem hiding this comment.
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
Signed-off-by: Steve Hipwell <steve.hipwell@gmail.com>
887d11a to
f9300e7
Compare
Resolves #ISSUE_NUMBER
Before the change?
After the change?
organization_repository_roledata sourceorganization_repository_rolesdata sourceidfield torolesrole_idfield forrolesorganization_roledata sourceorganization_role_teamsdata sourceidfield toteamsteam-idfield forteamsdescription,type,privacy,assignment&parent_teamfields torolesorganization_role_usersdata sourceassignmentfield tousersorganization_rolesdata sourceidfield torolesrole_idfield forrolesorganization_teamsdata sourceresults_per_pagetype,notification_setting,permission&parent_teamfields toteamsparent_team_id&parent_team_slugforteamsrepository_teamsdata sourcefull_namefield for consistency (it's also not valid to query non-authenticated organization repositories for teams)id,node_id,description,type,privacy&access_sourcefields toteamsteamdata sourceresults_per_pageteam_id,node_id,type&parent_teamfieldsPull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!