Skip to content

github_branch needs to not fail if branch doesn't exist #747

Closed

Description

@threeseed

Affected Resource(s)

  • github_branch

For a new repository (or one in which the branch doesn't exist) the following will fail the entire plan/apply. It would be nice if etag/ref/sha were null so that we could use that to conditionally create other resources.

In my case I want to set the develop branch to the default IF the branch exists.

Terraform Configuration Files

data "github_branch" "main" {
  repository                = github_repository.repository.name
  branch                    = "develop"
}

Error Output

GET https://api.github.com/repos/<org>/<repo>/git/ref/heads/main: 404 Not Found []

Activity

  1. added
    Type: Feature
    Good first issue
    on Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueType: Featurer/branch

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions