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 when creating a github_branch_protection_v3 #1451

Closed
gilacost opened this issue Dec 23, 2022 · 2 comments
Closed

Error when creating a github_branch_protection_v3 #1451

gilacost opened this issue Dec 23, 2022 · 2 comments
Labels
Type: Bug Something isn't working as documented

Comments

@gilacost
Copy link

Terraform Version

Terraform v1.3.4
on darwin_amd64
+ provider registry.terraform.io/integrations/github v5.12.0

Affected Resource

  • github_branch_protection_v3

Terraform Configuration Files

terraform {
  required_providers {
    github = {
      source  = "integrations/github"
      version = "5.12.0"
    }
  }

  required_version = ">= 1.0"
}

provider "github" {
  owner = local.owner
}

locals {
  owner = "PepOps"
  repos = [
    {
      name         = "test",
      description  = "a  description"
      context_list = ["Lint Code Base"]
    }
  ]
}

resource "github_repository" "main" {
  allow_auto_merge            = true
  allow_merge_commit          = false
  allow_rebase_merge          = false
  allow_squash_merge          = true
  squash_merge_commit_title   = "PR_TITLE"
  squash_merge_commit_message = "COMMIT_MESSAGES"
  delete_branch_on_merge      = true
  description                 = local.repos[0].description
  has_issues                  = true
  has_projects                = true
  name                        = local.repos[0].name
  topics                      = []
  visibility                  = "private"
  vulnerability_alerts        = true
  allow_update_branch         = true
}

resource "github_branch_protection_v3" "main" {
  branch                          = "main"
  enforce_admins                  = false
  repository                      = "test"
  require_conversation_resolution = false
  require_signed_commits          = false

  required_pull_request_reviews {
    dismiss_stale_reviews           = false
    dismissal_teams                 = []
    dismissal_users                 = []
    include_admins                  = false
    require_code_owner_reviews      = false
    required_approving_review_count = 1
  }

  required_status_checks {
    contexts = [
      "Lint Code Base",
    ]
    include_admins = false
    strict         = true
  }
}

Debug Output

https://gist.githubusercontent.com/gilacost/91ed474e824d1efe21881bde22e8cd97/raw/0750a86e2ddb9b45ef9962fa74f2d2ad3fbf247d/tf.log

Panic Output

None

Expected Behaviour

github_branch_protection_v3 is created successfully.

Actual Behaviour

╷
│ Error: PUT https://api.github.com/repos/BeamOps/book/branches/main/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"=>true, "contexts"=>["Lint Code Base"], "checks"=>nil} is not a null. []
│ 
│   with github_branch_protection_v3.main,
│   on main.tf line 48, in resource "github_branch_protection_v3" "main":
│   48: resource "github_branch_protection_v3" "main" {
│ 
╵

Steps to Reproduce

1. `terraform apply`

Important Factoids

None

References

None

@TheQueenIsDead
Copy link
Contributor

I'm not sure this issue needs to be open as it duplicates #1307 and somewhat #1147, though believe me I know the frustration!

@nickfloyd nickfloyd added Type: Bug Something isn't working as documented Priority: High labels Dec 30, 2022
@kfcampbell
Copy link
Member

@TheQueenIsDead is right; I'm going to close this. Please subscribe to the other issue(s) for updates, and I'll make time to review the proposed fix in #1415 soon.

@kfcampbell kfcampbell closed this as not planned Won't fix, can't repro, duplicate, stale Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

4 participants