Importing team repos with github provider

Hello,

I’m trying to import a github organization into terraform using this bash script I’ve found on the internet:

however, the part with the team repos seems to be outdated, because according to the github api documentation (https://docs.github.com/en/rest/reference/teams#get-a-team-legacy) getting a team by id is a legacy method and instead, slug should be used. however, the github provider documentation is stating that team_id should be used even though it is legacy (https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team_repository)

So, whenever I try to import the team repos with a slug, I get the following error:


github_team_repository.megarandom123_publicrepo: Refreshing state... [id=megarandom123:publicrepo]
2021-12-16T12:41:23.680+0200 [ERROR] vertex "import github_team_repository.megarandom123_publicrepo result" error: Unexpected ID format ("megarandom123"), expected numerical ID. strconv.ParseInt: parsing "megarandom123": invalid syntax
2021-12-16T12:41:23.680+0200 [ERROR] vertex "github_team_repository.megarandom123_publicrepo (import id \"megarandom123:publicrepo\")" error: Unexpected ID format ("megarandom123"), expected numerical ID. strconv.ParseInt: parsing "megarandom123": invalid syntax
╷
│ Error: Unexpected ID format ("megarandom123"), expected numerical ID. strconv.ParseInt: parsing "megarandom123": invalid syntax

I’ve also been having a hard time importing them with team_id too.

Has anyone imported team repos this way recently?

Seems similar to Terraform fails to import github_team_repository with Github team slug as team_id · Issue #1498 · integrations/terraform-provider-github · GitHub and Release v5.16.0 · integrations/terraform-provider-github · GitHub has the fix.