Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error creating github repo using terraform

Receiving below error while trying to create a github repo using terraform Error below. Can some help help me to understand what am i missing here?

Error: POST https://api.github.com/repos/github/terraform-module-template/generate: 404 Not Found []

My script below

terraform {
  required_providers {
    github = {
      source = "integrations/github"
      version = "4.29.0"
    }
  }
}
provider "github" {
  token = "PAT here"

}

resource "github_repository" "byterraform" {
  name        = "byterraform"
  description = "Repo created by terraform script"

  visibility = "private"

  template {
    owner      = "github"
    repository = "terraform-module-template"
  }
}
like image 495
G_S Avatar asked Oct 16 '25 23:10

G_S


2 Answers

Issue is due to template code i.e.

Remove below lines from code

  template {
    owner      = "github"
    repository = "terraform-module-template"
  }

since this code is trying to refer a template file but is unable to find one since there is none being passed to terraform, hence it gave 404 error.

like image 93
Ankit Singh Avatar answered Oct 18 '25 15:10

Ankit Singh


Faced similar issue. Solved by:

  • Re-generated github token
  • used/replaced new token to/in provider "github" { token = "Re-generated github token" }
like image 22
user22597196 Avatar answered Oct 18 '25 15:10

user22597196



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!