Skip to content

github_repository_collaborator unable to validate triage and maintain permissions #480

@HorizonNet

Description

@HorizonNet

Terraform Version

v0.12.24

Provider Version

v2.8.0

Affected Resource(s)

  • github_repository_collaborator

Terraform Configuration Files

data "github_membership" "test-user" {
  username = "testuser"
}

resource "github_repository" "my-repo" {
  name        = "my-repo"
  private     = true
  description = ""
}

resource "github_repository_collaborator" "my-repo-test-user" {
  repository = github_repository.my-repo.name
  username   = data.github_membership.test-user.username
  permission = "maintain"
}
terraform import github_repository_collaborator.my-repo-test-user my-repo:testuser

Expected Behavior

After importing an existing collaborator with Maintain permissions the collaborator should have maintain permissions in the state.

Actual Behavior

After importing an existing collaborator with Maintain permissions the collaborator gets push permissions in the state. Running terraform plan afterwards notes a replacement.

# github_repository_collaborator.my-repo-test-user must be replaced
-/+ resource "github_repository_collaborator" "my-repo-test-user" {
      ~ id            = "my-repo:testuser" -> (known after apply)
      + invitation_id = (known after apply)
      ~ permission    = "push" -> "maintain" # forces replacement
        repository    = "my-repo"
        username      = "testuser"
    }

Running terraform apply in the end leads to

Error: User testuser is already a collaborator

Overall, the error is similar to #469, but the actual problem seems to be the import to the state in this situation.

Steps to Reproduce

  1. terraform import github_repository_collaborator.my-repo-test-user my-repo:testuser
  2. terraform plan
  3. terraform apply

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Needs infoFull requirements are not yet known, so implementation should not be startedStatus: StaleUsed by stalebot to clean houseType: BugSomething isn't working as documentedr/repository_collaborator

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions