github_repository

This resource allows you to create and manage repositories within your GitHub organization or personal account.

Example Usage

resource "github_repository" "example" {
  name        = "example"
  description = "My awesome codebase"

  visibility = "public"

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

Example Usage with GitHub Pages Enabled

resource "github_repository" "example" {
  name        = "example"
  description = "My awesome web page"

  private = false

  pages {
    source {
      branch = "master"
      path   = "/docs"
    }
  }
}

Argument Reference

The following arguments are supported:

GitHub Pages Configuration

The pages block supports the following:

GitHub Pages Source

The source block supports the following:

Security and Analysis Configuration

The security_and_analysis block supports the following:

Advanced Security Configuration

The advanced_security block supports the following:

Secret Scanning Configuration

Secret Scanning Push Protection Configuration

Template Repositories

template supports the following arguments:

Attributes Reference

The following additional attributes are exported:

Import

Repositories can be imported using the name, e.g.

$ terraform import github_repository.terraform terraform