terraform-provider-github
terraform-provider-github copied to clipboard
Unable to create a repository in an organisation
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