Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error applying branch protection #31

Closed
DWSR opened this issue Jul 5, 2017 · 1 comment
Closed

Error applying branch protection #31

DWSR opened this issue Jul 5, 2017 · 1 comment

Comments

@DWSR
Copy link
Contributor

DWSR commented Jul 5, 2017

Terraform Version

0.9.8

Affected Resource(s)

github_branch_protection

Terraform Configuration Files

# Here is where the main parts of the module go, including resource definitions
resource "github_repository" "repo" {
  name = "${var.name}"
  description = "${var.description}"
  private = "${var.private}"
  has_issues = false
  has_wiki = false
  has_downloads = false
  auto_init = true
}
resource "github_branch_protection" "repo_master" {
  repository = "${github_repository.repo.name}"
  branch = "master"
  required_status_checks {
    include_admins = "${var.restrict_admins}"
    strict = true
  }
  required_pull_request_reviews {
    include_admins = "${var.restrict_admins}"
  }
}

resource "github_team_repository" "members" {
  count = "${length(var.members)}"
  team_id = "${element(var.members, count.index)}"
  role = "push"
}

resource "github_team_repository" "admins" {
  count = "${length(var.admins)}"
  team_id = "${element(var.admins, count.index)}"
  role = "admin"
}

Debug Output

https://gist.github.com/DWSR/c9a1a1c6eb4132b9d667764f01944fef#file-terraform-log

Panic Output

N/A

Expected Behavior

Terraform should apply a branch protection to the master branch

Actual Behavior

https://gist.github.com/DWSR/c9a1a1c6eb4132b9d667764f01944fef#file-error-txt

Steps to Reproduce

terraform apply

References

The request body doesn't seem to line up with the required contents, per https://developer.github.com/v3/repos/branches/#update-branch-protection

@grubernaut
Copy link
Contributor

Hey @DWSR, thanks for the issue!

This was just fixed in #26, and should be available in the next release of the GitHub provider if you're using 0.10 already. If you wish to stick with 0.9.x, you'll need to compile the provider and place the resulting binary in the same location of your Terraform binary, or specify a location in your global terraformrc file.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants