Skip to content

Data source github_team returns 404 #655

@eleni-salamani

Description

@eleni-salamani

Using the github_team data source with the latest provider version returns 404.

Terraform Version

✗ terraform -v
Terraform v0.13.6

  • provider registry.terraform.io/hashicorp/aws v2.48.0
  • provider registry.terraform.io/hashicorp/github v4.1.0
  • provider registry.terraform.io/hashicorp/null v2.1.2
  • provider registry.terraform.io/integrations/github v4.2.0

Affected Resource(s)

  • github_team data source

Terraform Configuration Files

data "github_team" "team_details" {
  for_each = var.teams

  slug = each.key

}

resource "github_team_repository" "repository_team" {
  for_each = var.teams

  repository = github_repository.repository.name
  team_id    = data.github_team.team_details[each.key].id
  permission = each.value
}

and the provider configuration

terraform {
  required_providers {
    github = {
      source = "integrations/github"
      version = "4.2.0"
    }
  }
}

provider "github" {
  version = "4.2.0"

  organization = "myorg"
  token        = "blabla"
}

Debug Output

https://gist.github.com/eleni-salamani/bf0a8d0173700c95e6451ff6c78600a7

Panic Output

Expected Behavior

The data source should return the team information so that it can be used in further resources.

Actual Behavior

The call returns 404. It seems the API call is not built correctly as the organization is not set.

Error: GET https://api.github.com/orgs//teams/b2b: 404 Not Found []

  on modules/repository/main.tf line 61, in data "github_team" "team_details":
  61: data "github_team" "team_details" {

https://github.com/integrations/terraform-provider-github/blob/master/github/data_source_github_team.go#L57

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Add the github_team data source.
  2. Make sure the organization information is set in the provider
  3. Issue terraform apply

Important Factoids

References

Metadata

Metadata

Assignees

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions