Skip to content

[BUG]: Resource github_team_repository fails due to non-existent alternative API on GitHub Enterprise #3052

@holmesbenedikt

Description

@holmesbenedikt

Expected Behavior

Resource github_team_repository is correctly applied to a GitHub Enterprise instance (v3.16.11).

Actual Behavior

Resource github_team_repository errors when applied to a GitHub Enterprise instance (v3.16.11) returning a 404 on the underlying HTTP PUT request. Other resources in use, e.g., github_team or github_organization_repository_role, were already successfully applied without any issues.

The API docs for v3.16 contains the following information for the endpoint (Add or update team repository permissions) used for this resource:

  • Request is to be made as PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}
  • Request can alternatively made as PUT /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}

It seems like the provider uses the second API, which is either not available or supported on GitHub Enterprise.

Terraform Version

Terraform v1.10.0
on linux_amd64

  • provider registry.terraform.io/integrations/github v6.9.0

Affected Resource(s)

  • github_team_repository

Terraform Configuration Files

terraform {
  required_providers {
    github = {
      source  = "integrations/github"
      version = "6.9.0"
    }
  }
  cloud {
    organization = "<ORG>"
    workspaces {
      name = "<WORKSPACE>"
    }
  }
}

provider "github" {
  owner    = "<OWNER>"
  base_url = "<GITHUB_ENTERPRISE_HOST>"
  app_auth {
    ...
  }
}

resource "github_team_repository" "maintainer" {
  team_id    = "<TEAM_ID>"
  repository = "<REPO_NAME>"
  permission = "maintain"
}

Steps to Reproduce

$ terraform apply

Debug Output

Error: PUT https://<GITHUB_ENTERPRISE_HOST>/api/v3/organizations/<ORG_ID>/team/<TEAM_ID>/repos/<OWNER>/<REPO_NAME>: 404 Not Found []

Panic Output

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions