terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

GitHub Apps Authentication Requires GITHUB_OWNER to work

Open Aya-Inocentes opened this issue 3 years ago • 0 comments

Hello, I've been trying to authenticate my terraform-github and as per documentation you'll need only the following variables when authenticating using GitHub Apps: provider "github" { app_auth { id = var.app_id # or GITHUB_APP_ID installation_id = var.app_installation_id # or GITHUB_APP_INSTALLATION_ID pem_file = var.app_pem_file # or GITHUB_APP_PEM_FILE }

provider "github" {
  app_auth {
    id              = var.app_id              # or `GITHUB_APP_ID`
    installation_id = var.app_installation_id # or `GITHUB_APP_INSTALLATION_ID`
    pem_file        = var.app_pem_file        # or `GITHUB_APP_PEM_FILE`
  }
}

But I've been an error:

 Error: GET https://api.github.com/user: 403 Resource not accessible by integration []
│
│   with provider["registry.terraform.io/integrations/github"],
│   on providers.tf line 14, in provider "github":
│   14: provider "github" {

Only when I've set the environment variable: export GITHUB_OWNER="owner" then it works.

Terraform Version

Terraform v1.0.1

Affected Resource(s)

provider registry.terraform.io/integrations/github v4.31.0

Terraform Configuration Files

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

provider "github" {
  app_auth {
    id="<ommited>"
    installation_id="<ommited>"
    pem_file=file("<ommited>")
  }
}

Expected Behavior

provider "github" {
  app_auth {
    id              = var.app_id              # or `GITHUB_APP_ID`
    installation_id = var.app_installation_id # or `GITHUB_APP_INSTALLATION_ID`
    pem_file        = var.app_pem_file        # or `GITHUB_APP_PEM_FILE`
  }
}

Should be working but I'm getting an error

Actual Behavior

 Error: GET https://api.github.com/user: 403 Resource not accessible by integration []
│
│   with provider["registry.terraform.io/integrations/github"],
│   on providers.tf line 14, in provider "github":
│   14: provider "github" {

Steps to Reproduce

  1. terraform apply

Aya-Inocentes avatar Sep 14 '22 22:09 Aya-Inocentes