Skip to content

[BUG]: team_id forces convert to int format when creating github_team_repository resource #3041

@iv0rish

Description

@iv0rish

Expected Behavior

Create github_team_repository resource with teamId or slug starting with 0.

Actual Behavior

We have hundreds of teams which both team_id and slug starts with 0.

When creating github_team_repository resource, teamId is being converted from a string to an integer, and team IDs that start with zero are being automatically altered. For example, if teamId is 000123, it is converted to 123 when the API request is made.

I think the snippet below is affecting to this issue when creating the resource

d.SetId(buildTwoPartID(strconv.FormatInt(teamId, 10), repoName))

Only creating the resource is the issue, read / update / delete action does not change the string format.

Terraform Version

Terraform v1.9.8
on linux_amd64

and

Terraform v1.13.2
on darwin_arm64

Affected Resource(s)

  • github_team_reopsitory

Terraform Configuration Files

Steps to Reproduce

Sample resource block

resource "github_team_repository" "team_repo" {
  for_each = { for k, v in local.collab : v.team_id => v }

  team_id      = local.collab.team_id
  repository  = local.collab.repository
  permission = local.collab.permission

}

locals {
  collab = {
    team_id      = "000123"
    repository  = {REPO}
    permission = "pull"
  }
}

When applying:

github_team_repository.team_repo["000123"]: Creating...


Error: PUT https://{GITHUB_HOST}/api/v3/organizations/{ORG}/team/123/repos/{OWNER}/{REPO}: 404 Not Found []

 with github_team_repository.team_repo["000123"]:
1 : resource "github_team_repository" "team_repo" {

Operation failed: failed running terraform apply (exit 1)

Debug Output

Panic Output

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is being looked at and prioritizedType: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions