terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

502 Bad request errors when using github_teams datasource

Open jeremycopinlm opened this issue 2 years ago • 2 comments

Hi there,

Terraform Version

1.0.11 mainly but tested with 1.2.8 too

Affected Resource(s)

  • github_team

Terraform Configuration Files

github_team_names = [
  "team1",
  "team2",
  "teamX",
]
terraform {
  required_providers {
    github = {
      version = "~> 4.12"
      source = "integrations/github"
      }
    }
}

provider "github" {
  token = <powerful_token>
  owner = <organization>
}

variable "github_team_names" {
  type = list(any)
}

data "github_team" "main_teams" {
  for_each = toset(var.github_team_names)
  slug     = each.value
}

Debug Output

│ Error: GET https://api.github.com/organizations/*****/team/****/repos?page=2&per_page=100: 502 Server Error []
│ 
│   with data.github_team.main_teams["team1"],
│   on github.tf line 42, in data "github_team" "main_teams":
│   42: data "github_team" "main_teams" {

-always returning a 502 when the team is owning many repos -same behaviour with only one team in "github_team_names" list

Panic Output

no panic error

Expected Behavior

We should not have a 502 error EVERY time... And get all informations from the datasource

Actual Behavior

"502 Server Error" or "Bad request"

Steps to Reproduce

terraform plan

Important Factoids

Teams managing hundreds of repositories Large organization

I checked the token quotas, we're good

jeremycopinlm avatar Sep 08 '22 15:09 jeremycopinlm

Hello, also interested by this issue. I'd like to be able to get teams without their membership. For example, by providing a "membership_type" value as "none".

chapurlatn avatar Sep 09 '22 08:09 chapurlatn

Could be great also filtering attributes we get from this datasource (no need of all repositories for example, I just need team id)

jeremycopinlm avatar Sep 09 '22 08:09 jeremycopinlm

related: https://github.com/integrations/terraform-provider-github/issues/1377 re "(no need of all repositories for example, I just need team id)"

alexlo03 avatar Nov 21 '22 18:11 alexlo03

This should fix it: #1379 I found the same issue on github_organization_teams and was able to fix it with #1176. You can either reduce the number of results_per_page or use the summary_only flag (or both).

david-bain avatar Nov 22 '22 12:11 david-bain

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

github-actions[bot] avatar Apr 20 '24 01:04 github-actions[bot]