Skip to content

[BUG] github_branch_protection_v3 tries to delete the contexts every time #1701

@julioagos

Description

@julioagos

Problem

I created some branch protection rules for some branches. These rules included required checks. After I applied them, it created matching contexts and a new check that is just one of the required checks with an app_id that always changes (First 4 digits remain the same, the rest changes). Now, every time I ran plan, it says that it is going to delete them again. The branch protections are working just as intended but, running plan always generates meaningless noise that get's in the way especially since we have a lot of branch protection rules once we fully migrate it over to Terraform. The applies are all run by Atlantis on PRs. This is what an example output of what terraform state show looks like for one of the branches:

    required_status_checks {
        checks         = [
            "test 1",
            "test 2",
            "test 1:<random-numbers>",
        ]
        contexts       = [
            "test 1",
            "test 2",
        ]
    }

Running terraform plan returns something like this

      ~ required_status_checks {
          ~ checks         = [
              - "test 1:<random-numbers>",
                # (2 unchanged elements hidden)
            ]
          ~ contexts       = [
              - "test 1",
              - "test 2",
            ]
            # (2 unchanged attributes hidden)
        }

There are no error messages at any point and the apply works as intended. It states that all plans have been applied.

Versions

Terraform: v1.4.4
GitHub Provider: Originally 5.23.0 but also happens in 5.25.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: PinnedA way to keep old or long lived issues aroundStatus: Up for grabsIssues that are ready to be worked on by anyoneType: BugSomething isn't working as documentedhacktoberfestIssues for participation in HacktoberfestvNext

    Type

    No type

    Projects

    Status

    🔥 Backlog

    Status

    On Deck

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions