github_repository_environment

This resource allows you to create and manage environments for a GitHub repository.

Example Usage

data "github_user" "current" {
  username = ""
}

resource "github_repository" "example" {
  name        = "A Repository Project"
  description = "My awesome codebase"
}

resource "github_repository_environment" "example" {
  environment         = "example"
  repository          = github_repository.example.name
  prevent_self_review = true
  reviewers {
    users = [data.github_user.current.id]
  }
  deployment_branch_policy {
    protected_branches     = true
    custom_branch_policies = false
  }
}

Argument Reference

The following arguments are supported:

Reviewers

The reviewers block supports the following:

Deployment Branch Policy

The deployment_branch_policy block supports the following:

Import

GitHub Repository Environment can be imported using an ID made up of name of the repository combined with the environment name of the environment, separated by a : character, e.g.

$ terraform import github_repository_environment.daily terraform:daily