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

[BUG] Branch protection resource - invalid requrest #1374

Closed
svalevka opened this issue Nov 20, 2022 · 2 comments
Closed

[BUG] Branch protection resource - invalid requrest #1374

svalevka opened this issue Nov 20, 2022 · 2 comments
Labels
Duplicate There are other issues and PRs like this Type: Bug Something isn't working as documented

Comments

@svalevka
Copy link

Branch protection request resource creation fail

How to reproduce:

  • provider version 5.9.0
  • terraform resource
resource "github_branch_protection_v3" "example" {
  repository     = "terraform-github-management"
  branch         = "dev"

  required_status_checks {
    strict   = false
    contexts = ["Naming conventions / Branch"]
  }

}

terraform apply result

github_branch_protection_v3.example: Creating...
╷
│ Error: PUT https://api.github.com/repos/xxx/terraform-github-management/branches/dev/protection: 422 Invalid request.
│ 
│ No subschema in "anyOf" matched.
│ For 'properties/checks', nil is not an array.
│ Not all subschemas of "allOf" matched.
│ For 'anyOf/1', {"strict"=>false, "contexts"=>["Naming conventions / Branch"], "checks"=>nil} is not a null. []
│ 
│   with github_branch_protection_v3.example,
│   on main.tf line 1, in resource "github_branch_protection_v3" "example":
│    1: resource "github_branch_protection_v3" "example" {

When resource is created manually from console, I can see it fine:

protection=$(gh api  -H "Accept: application/vnd.github+json" /repos/${ORG}/${REPO}/branches/dev/protection)

echo $protection | jq -r '.required_status_checks'
{
  "url": "https://api.github.com/repos/xxx/terraform-github-management/branches/dev/protection/required_status_checks",
  "strict": true,
  "contexts": [
    "Naming conventions / Branch"
  ],
  "contexts_url": "https://api.github.com/repos/xxx/terraform-github-management/branches/dev/protection/required_status_checks/contexts",
  "checks": [
    {
      "context": "Naming conventions / Branch",
      "app_id": 12345
    }
  ]
}

@svalevka svalevka changed the title Branch protection resource - invalid requrest [BUG] Branch protection resource - invalid requrest Nov 20, 2022
@svalevka
Copy link
Author

Potentially duplicate of #1307

@kfcampbell
Copy link
Member

This is indeed a duplicate of #1307; let's continue future conversation over there. If you're interested in opening a PR to fix this behavior, I'd be happy to review!

@kfcampbell kfcampbell closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2022
@kfcampbell kfcampbell added Type: Bug Something isn't working as documented Priority: High Duplicate There are other issues and PRs like this labels Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate There are other issues and PRs like this Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

2 participants