0

I'm not able to say terraformer to use other url than https://api.github.com

Terraformer: https://github.com/GoogleCloudPlatform/terraformer

Terraform Github provider: https://github.com/integrations/terraform-provider-github

It looks like that provider is supporting Github Enterprise by providing export GITHUB_BASE_URL= mechanism to provide different base_url.

But the behaviour of terraformer is not changed after.

$export GITHUB_BASE_URL=https://git.enterprise.com/

$terraformer import github --organizations=org --resources=repositories --token=***

2021/04/07 16:12:55 github importing organization org

2021/04/07 16:12:55 github importing... repositories

2021/04/07 16:12:56 GET https://api.github.com/orgs/bt/repos?per_page=100

Any advice, how to bypass this hardcoded value?

lioil
  • 405
  • 2
  • 5

1 Answers1

0

You need to change this

tc := oauth2.NewClient(ctx, ts)

here: terraformer/providers/github/repositories.go

for this:

baseUrl := "https://_YOUR_GITHUB_ENTERPRISE_BAS_URL_/api/v3/"
client, _ := githubAPI.NewEnterpriseClient(baseUrl, baseUrl, tc)

The same for other resources like teams.go, members.go, ...

lioil
  • 405
  • 2
  • 5
  • Terraformer v0.8.13 fix this in this PR https://github.com/GoogleCloudPlatform/terraformer/pull/871 by adding new commandline parameter for github service `./terraformer import github --owner=YOUR_ORGANIZATION --resources=repositories --base-url=https://your-enterprise-github-url` – lioil Apr 23 '21 at 09:14
  • Following PR to fix this https://github.com/GoogleCloudPlatform/terraformer/pull/894 – lioil Apr 27 '21 at 14:51