Skip to content

Unable to create a repository in an organisation #876

@jeroenjacobs79

Description

@jeroenjacobs79

Hello,

I'm trying to create a repository in an organisation using my personal access token. My config is something like this:


terraform {
  required_version = "=1.0.3"
  required_providers {
    aws = {
      version = "=3.52.0"
      source = "hashicorp/aws"
    }
    tls = {
      source = "hashicorp/tls"
      version = "=3.1.0"
    }
    github = {
      source  = "integrations/github"
      version = "=4.13.0"
    }
  }
}
provider "github" {
  owner = "headincloud"
}

resource "github_repository" "app_repo" {
  name        = "cluster-apps"
  description = "App repository"

  visibility = "private"
  delete_branch_on_merge = "true"
}

I have set the GITHUB_TOKEN to my PAT (which I granted all the permissions for now), but the repo still gets created under my own user-name, not onder my organisation.

Now, maybe creating organisation repos doesn't work with PAT's, and I should use OAuth? But I have no clue on how to proceed with this. When trying to create a new GitHub OAuth app, it asks for a homepage URL and callback URL but I have no clue on what I should put here for TerraForm. The documentation is not clear on this either...

So, what is the correct approach here? I believe the documentation could be improved on this subject.

Terraform version: 1.0.3
Github provider version: 4.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions