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: Field 'requireLastPushApproval' doesn't exist on type 'BranchProtectionRule' #1586

Closed
enricojonas opened this issue Mar 8, 2023 · 5 comments
Labels
github_enterprise hacktoberfest Issues for participation in Hacktoberfest Status: Stale Used by stalebot to clean house Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@enricojonas
Copy link

Terraform Version

Terraform v1.3.9
on linux_amd64
+ provider registry.terraform.io/integrations/github v5.18.0

GHES 3.7.4

This problem is there since v5.12.0, it is working fine with v5.11.0. We cannot upgrade because of this. I hope it will work with GHES 3.8.0+ but we cannot be sure. Shouldn't we ensure compatibility with current minor release of GHES at least?

Affected Resource(s)

github_branch_protection.main

Terraform Configuration Files

resource "github_branch_protection" "main" {
  for_each                        = local.repositories
  repository_id                   = github_repository.repos[each.key].id
  allows_deletions                = false
  allows_force_pushes             = false
  enforce_admins                  = true
  pattern                         = "main"
  push_restrictions               = []
  require_conversation_resolution = false
  require_signed_commits          = false
  required_linear_history         = false

  required_pull_request_reviews {
    dismiss_stale_reviews           = true
    dismissal_restrictions          = []
    require_code_owner_reviews      = false
    required_approving_review_count = 1
    restrict_dismissals             = false
  }

  required_status_checks {
    contexts = can(each.value.required_status_checks) ? each.value.required_status_checks : []
    strict   = true
  }
}

I have also tried to add require_last_push_approval = false to required_pull_request_reviews but that doesn't help either.

What should have happened?
Branch protection rule should have been applied without error

What actually happened?
Following error is thrown:

│ Error: Field 'requireLastPushApproval' doesn't exist on type 'BranchProtectionRule'
│ 
│   with github_branch_protection.main["xxx"],
│   on github_branch_protection.tf line 1, in resource "github_branch_protection" "main":
│    1: resource "github_branch_protection" "main" {

Please list the steps required to reproduce the issue, for example:

terraform apply
@pascal-hofmann
Copy link
Contributor

The field was added in 3.8: https://docs.github.com/en/[email protected]/graphql/reference/objects

@kfcampbell kfcampbell added Type: Bug Something isn't working as documented github_enterprise Priority: Normal labels Mar 10, 2023
@nickfloyd nickfloyd added the Status: Up for grabs Issues that are ready to be worked on by anyone label Mar 24, 2023
@nickfloyd nickfloyd moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Active Mar 24, 2023
@seanorama
Copy link

There are many other reports of issues with GHES depending on version, so we will likely always be chasing something that github.com has but GHES doesn't.

How can the provider be updated to not fail if certain features are missing? Or allow defining the GHES version, which ties to a map of support features (versioning).

@kfcampbell
Copy link
Member

There's been a little bit of discussion around that idea here. We should really open a separate issue to track the GHES versioning difficulties.

@macetw
Copy link
Contributor

macetw commented May 16, 2023

Is there a hope of this being fixed without a big feature of version-tracking? There are many of us not using GitHub-cloud.

@nickfloyd nickfloyd added the hacktoberfest Issues for participation in Hacktoberfest label Sep 20, 2023
Copy link

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Status: Stale Used by stalebot to clean house label Jun 18, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2024
@github-project-automation github-project-automation bot moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Active Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_enterprise hacktoberfest Issues for participation in Hacktoberfest Status: Stale Used by stalebot to clean house Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

6 participants