terraform-provider-github: [BUG]: `github_team_repository` error with version 5.9.0 - fails with `at least one permission expected from permissions map`

Terraform Version

1.3.3

Affected Resource(s)

  • github_team_repository

If this issue appears to affect multiple resources, it may be an issue with Terraform’s core, so please mention this.

Terraform Configuration Files

resource "github_team_repository" "push_access" {
  for_each   = toset(var.push_access_team_ids)
  repository = github_repository.repository.id
  team_id    = each.value
  permission = "push"
}

Debug Output

[PENDING] Please provide a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Panic Output

N/A

Expected Behavior

Access should be refreshed, changes should be proposed by terraform plan

Actual Behavior

terraform plan errors:

╷
│ Error: at least one permission expected from permissions map
│ 
│   with module.easyhotel_docker_compose_repository.github_team_repository.push_access["6845313"],
│   on modules/easyhotel_github_repository/main.tf line 34, in resource "github_team_repository" "push_access":
│   34: resource "github_team_repository" "push_access" {
│ 
╵

Steps to Reproduce

With existing repo/permissions

  • terraform plan will fail with above error

With non-existing permissions (permissions need to be created by this terraform run)

  • terraform apply will create the permission/s above (verified that access was given by checking the GitHub web UI), but the apply will still fail with the same error above.

Important Factoids

Is there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

References

Similar error messages (not the same cause I guess):

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 67
  • Comments: 27 (4 by maintainers)

Commits related to this issue

Most upvoted comments

There’s a fix for the issue in #1384. Confirmed the acceptance tests for github_team_repository pass after introducing this change

workaround

terraform {
  required_providers {
    github = {
      source  = "integrations/github"
      version = "!= 5.9.0"
    }
  }
}

@nickfloyd https://github.com/integrations/terraform-provider-github/pull/1382 is a stab at fixing this in a way that doesn’t break the new feature that was added

5.9.1 wasn’t a fix for this issue @oprudkyi

Any idea when we can get this fix implemented. Also thank you @jhaumont for digging into all of this and finding a resolution.

It works for me with 5.9.2. We are using github_team_repository.

something wrong, 5.9.1 fails with the same error

We also are seeing this exact issue. Thanks for finding the issue @jhaumont. Is this able to be reverted as soon as possible please? I need the other features of 5.8.0 and 5.9.0.

Thanks for chasing this down @jhaumont!

The difference comes from the Accept header: vnd.github.v3.repository+json (working) instead of vnd.github.stone-crop-preview+json (not working) I don’t understand why this header is used as the default one is correct

stone-crop-preview is for the Team Review Assignments preview from the docs.

The change landed in #1356, specifically in 934f06a