-
Notifications
You must be signed in to change notification settings - Fork 949
unable to update branch_protections for github repos #1147
Copy link
Copy link
Closed as not planned
Labels
Status: StaleUsed by stalebot to clean houseUsed by stalebot to clean houseStatus: Up for grabsIssues that are ready to be worked on by anyoneIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documentedSomething isn't working as documented
Description
Hi there,
We were trying to enable enforce_admins = true and we see a TF plan like the following but when we apply we get an error. As you can see below there are no changes to required_status_checks but we are not able to apply it.
# module.repositories.github_branch_protection_v3.managed["REPO_NAME:BRANCH_NAME"] will be updated in-place
~ resource "github_branch_protection_v3" "managed" {
~ enforce_admins = false -> true
id = "REPO_NAME:BRANCH_NAME"
# (5 unchanged attributes hidden)
# (2 unchanged blocks hidden)
}
Terraform Version
1.0.9- terraform-provider-github:
v4.24.1
Affected Resource(s)
Please list the resources as a list, for example:
- github_branch_protection_v3
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
resource "github_branch_protection_v3" "example" {
repository = github_repository.example.name
branch = "main"
enforce_admins = true
required_status_checks {
strict = true
contexts = []
}
}
Debug Output
unfortunately I'm not allowed to share full debug output due to company policy, here's some relevant debug logs:
2022-05-12T09:24:17.198-0700 [DEBUG] provider.terraform-provider-github_v4.24.1: {
2022-05-12T09:24:17.198-0700 [DEBUG] provider.terraform-provider-github_v4.24.1: "message": "Invalid request.\n\nNo subschema in \"anyOf\" matched.\nNo subschema in \"oneOf\" matched.\nNot all subschemas of \"allOf\" matched.\nFor 'anyOf/1', {\"strict\"=>true} is not a null.",
2022-05-12T09:24:17.198-0700 [DEBUG] provider.terraform-provider-github_v4.24.1: "documentation_url": "https://docs.github.com/rest/reference/repos#update-branch-protection"
2022-05-12T09:24:17.198-0700 [DEBUG] provider.terraform-provider-github_v4.24.1: }
│ Error: PUT https://api.github.com/repos/ORG_NAME/REPO_NAME/branches/BRANCH_NAME/protection: 422 Invalid request.
│
│ No subschema in "anyOf" matched.
│ No subschema in "oneOf" matched.
│ Not all subschemas of "allOf" matched.
│ For 'anyOf/1', {"strict"=>true} is not a null. []
│
│ with module.repositories.github_branch_protection_v3.managed["REPO_NAME:BRANCH_NAME"],
│ on ../../../modules/repositories/repository-branch-protection.tf line 1, in resource "github_branch_protection_v3" "managed":
│ 1: resource "github_branch_protection_v3" "managed" {
│
╵
Expected Behavior
- able to update branch protection
Actual Behavior
- seeing above errors
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
Important Factoids
- we use atlantis but the same error happens locally as well
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Status: StaleUsed by stalebot to clean houseUsed by stalebot to clean houseStatus: Up for grabsIssues that are ready to be worked on by anyoneIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documentedSomething isn't working as documented
Type
Projects
Status
🆕 Triage
Status
Done