feat: Update repository collaborators to ignore non-direct teams - #3571
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. |
There was a problem hiding this comment.
Pull request overview
These provider review instructions are being used.
Updates repository collaborator management to exclude teams without direct repository access and reduce Terraform drift.
Changes:
- Filters inherited organization and enterprise teams.
- Deprecates
ignore_teamand expands import state population. - Refactors acceptance tests and helpers.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
RESOURCES.md |
Updates resource readiness status. |
github/resource_github_team_members_test.go |
Adopts refactored team helpers. |
github/resource_github_repository_collaborators.go |
Implements collaborator filtering, hashing, pagination, and import changes. |
github/resource_github_repository_collaborators_test.go |
Reworks collaborator acceptance coverage. |
github/data_source_github_team_test.go |
Adopts team helpers. |
github/data_source_github_team_repositories_test.go |
Adopts repository-team helper. |
github/data_source_github_team_members_test.go |
Adopts parent-team helper. |
github/data_source_github_repository_teams_test.go |
Adopts repository-team helper. |
github/data_source_github_organization_teams_test.go |
Adopts team helpers. |
github/data_source_github_organization_role_users_test.go |
Refactors role assignment setup. |
github/data_source_github_organization_role_teams_test.go |
Refactors role assignment setup. |
github/acc_helpers_test.go |
Removes migrated acceptance helpers. |
github/acc_helpers_team_test.go |
Adds dedicated team test helpers. |
github/acc_helpers_repository_test.go |
Adds dedicated repository test helpers. |
docs/resources/repository_collaborators.md |
Documents deprecation and description changes. |
Comments suppressed due to low confidence (1)
github/resource_github_repository_collaborators.go:93
- The custom set hash excludes
permission, so a permission-only team change has the same set identity and can produce no resource diff. The update callback then never applies the new repository permission. Include permission in this hash as well as the normalized team identity.
Set: func(v any) int {
teamIDStr, _ := v.(map[string]any)["team_id"].(string)
return schema.HashString(strings.ToLower(teamIDStr))
},
We don't need to use |
9781424 to
78548e6
Compare
Signed-off-by: Steve Hipwell <steve.hipwell@gmail.com>
78548e6 to
a88eaba
Compare
robert-crandall
left a comment
There was a problem hiding this comment.
Thanks for tackling this, @stevehipwell. I built and vetted it locally on Go 1.26 (including the neat new(expr) usage) and everything's green; the deprecation path for ignore_team and the import state hydration both look right to me. 👍
Resolves #2781
Resolves #2623
Before the change?
github_repository_collaboratorsresource would churn with organization or enterprise teams present and not passed in via 1ignore_teams`After the change?
github_repository_collaboratorsresource ignores non-direct teams so no longer churns with organization or enterprise teams presentgithub_repository_collaboratorsresourceignore_teamsfield has been deprecated as it's no longer needed (usage for any other reason than ignoring organization or enterprise times was never supported)Pull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!