Skip to content

Branch protection rule failed to be created with new format Github repository node_id #908

@xun-guo-anzx

Description

@xun-guo-anzx

With Github migrating the repository's GraphQL global node ID to new format, branch protection rule resource cannot be created with node_id because the new format of node ID is no longer encoded by Base64.

Branch protection rule setup with repository name is still working correctly without being affected.

Terraform Version

0.14.11

Affected Resource(s)

  • github_branch_protection

Terraform Configuration Files

resource "github_repository" "new_example_repo" {
  name        = "new-example-repo"
  description = "New Example Repo"
}

resource "github_branch_protection" "example" {
  repository_id = github_repository.new_example_repo.node_id

  pattern          = "main"
  enforce_admins   = true
  allows_deletions = true
}

Expected Behavior

Branch protection rule should be created in the new repository.

Actual Behavior

Error reported as following:

Error: Could not resolve to a Repository with the name 'owner/R_xxXXXXxxXx'.

  on main.tf line 7, in resource "github_branch_protection" "example":
   7: resource "github_branch_protection" "example" {

Steps to Reproduce

  1. terraform apply

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Needs infoFull requirements are not yet known, so implementation should not be startedType: BugSomething isn't working as documentedr/branch_protection

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions