Skip to content

[DOCS]: Behaviour change in 6.12.1 vs 6.11.1 #3434

Closed

Description

@quotidian-ennui

Describe the need

THere's a side effect related to #3233 or maybe its related ones such that if you have github_repository_collaborators configured, for a personal, public repository

resource "github_repository_collaborators" "public_repo" {
  repository = "gh-my"
  user {
    username = "stevehipwell"
    permission = "write"
  }
}

Then you will always get tofu plan churn once it is applied, since you will repeatedly get this emitted when you plan.

  ~ resource "github_repository_collaborators" "public_repo" {
        id             = "xxxxxx"
      ~ invitation_ids = {} -> (known after apply)
        # (2 unchanged attributes hidden)

      - user {
          - permission = "admin" -> null
          - username   = "quotidian-ennui" -> null
        }

        # (1 unchanged block hidden)
    }

The work-around is to do add the repository owner as an admin.

resource "github_repository_collaborators" "public_repo" {
  repository = "gh-my"
  user {
    username = "stevehipwell"
    permission = "write"
  }
  user {
    username = "quotidian-ennui"
    permission = "admin"
  }
}

The behavioural change isn't a problem, but it needs to be made clearer.

  • I wouldn't consider myself a collaborator on my own repository
  • The documentation itself states for personal repositories, you only have the write permission to grant.
    c.f.

For personal repositories, collaborators can only be granted write (implicitly includes read) permission.

Relevant log output

Code of Conduct

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

Activity

  1. added
    Type: Documentation
    Status: Triage
    on May 16, 2026
  2. github-actions commented on May 16, 2026

    @github-actions

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

  3. deiga commented on May 17, 2026

    @deiga
    Collaborator

    @stevehipwell I haven't looked at the code, but I just realized that we don't seem to have any collaborator tests for the individual user account use-case 😬

    This might have been missed by accident. And TBH the behaviour doesn't look like what we'd want

  4. stevehipwell commented on May 18, 2026

    @stevehipwell
    Collaborator

    @deiga testing collaborators is painful as the GitHub TOS doesn't allow someone to have multiple accounts. We still should have tests written and automated where possible, but they're likely to only be possible to run locally with some coordination between users.

    RE this issue, the logic for user collaborators still doesn't look right. I think we need to add an extra plan modifier step to resolve this as the only drift should be on the computed invitations and this should just be on refresh.

    @quotidian-ennui is your user being assigned to the repo indirectly?

  5. added
    Type: Bug
    and removed
    Status: Triage
    on May 18, 2026
  6. added this to the v6.13.0 milestone on May 18, 2026
  7. quotidian-ennui commented on May 18, 2026

    @quotidian-ennui
    Author

    @stevehipwell
    The repo belongs to my user... i.e. the repo in question is quotidian-ennui/gh-my (for the purposes of the example).

    It feels like what you've done with the change isn't wrong but is a side-effect of how collaborators actually work behind the scenes. The repository owner is implicitly treated as a collaborator by github internals, just with admin privileges and the way you've refactored exposes that.

    (which is why I thought it might be a documentation issue, rather than an issue issue).

  8. stevehipwell commented on May 18, 2026

    @stevehipwell
    Collaborator

    @quotidian-ennui it's very much a bug that the plan is showing the users being removed only to have them recreated in the apply. Could you please add yourself to the resource with the correct admin permissions to see if it still churns?

    @deiga I suspect that this wasn't tested on a non-org repo where the owner wasn't included, I reckon we could tighten the code up to get rid of the diff. We probably need some logic to check if an unmapped user is the repo owner and treat them the same way we do for ignore teams.

  9. stevehipwell commented on May 18, 2026

    @stevehipwell
    Collaborator

    The behavioural change isn't a problem, but it needs to be made clearer.

    @quotidian-ennui we ought to be able to fix this is code. At least the non-owner user shouldn't be lost as this is likely to happen in other scenarios.

    I wouldn't consider myself a collaborator on my own repository

    In GitHub terminology you are, and like teams there is no metadata to figure out how the binding was granted.

    The documentation itself states for personal repositories, you only have the write permission to grant.
    c.f.
    For personal repositories, collaborators can only be granted write (implicitly includes read) permission.

    This sounds correct, although it looks like the API docs have lost this information. Did you experience something different?

  10. quotidian-ennui commented on May 18, 2026

    @quotidian-ennui
    Author

    Ok, so where I was coming from is around what I had to do to "resolve" the churn. Which is essentially to add myself, the owner of the repo, as an public collaborator, in addition to all the other collaborators that I have on the project.

    resource "github_repository_collaborators" "public_repo" {
      repository = "gh-my"
      user {
        username = "stevehipwell"
        permission = "write"
      }
      user {
        username = "quotidian-ennui"
        permission = "admin"
      }
    }

    If you were just reading the provider docs then

    • you wouldn't think that you needed to add yourself as a collaborator.
    • you wouldn't think that admin was a suitable permission to give any one on a non-org-scoped-repository because the documentation explicitly says "you can only give 'write'"

    From the point of view of the underlying github API, I understand why it is how it is, and I'm not bothered by that. If you can fix it in code in 6.13.0 then great; if you can't then it's worth just noting "there's a special case, add the repo owner with permission: admin otherwise you'll get churn. But only do that if the target repository is not organisation owned".

    After all, it's quite the edge case; who would use terraform to manage their own repositories! (apart from people like me). There will be higher priority things in 6.13.0 that need tackling I'm sure.

  11. stevehipwell commented on May 18, 2026

    @stevehipwell
    Collaborator

    #3437 aligns the docs to the current behaviour.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugType: Documentation

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions