This resource allows you to create and manage deployment branch policies.
resource "github_repository_environment" "env" {
repository = "my_repo"
environment = "my_env"
deployment_branch_policy {
protected_branches = false
custom_branch_policies = true
}
}
resource "github_repository_deployment_branch_policy" "foo" {
depends_on = [github_repository_environment.env]
repository = "my_repo"
environment_name = "my_env"
name = "foo"
}
The following arguments are supported:
repository
- (Required) The repository to create the policy in.
environment_name
- (Required) The name of the environment. This environment must have deployment_branch_policy.custom_branch_policies
set to true or a 404 error will be thrown.
name
- (Required) The name pattern that branches must match in order to deploy to the environment.
The following additional attributes are exported:
id
- The ID of the deployment branch policy.$ terraform import github_repository_deployment_branch_policy.foo repo:env:id