Skip to content

delete_branch_on_merge doesn't stay as true #476

Closed

Description

@zmingxie

I'm having issue with setting delete_branch_on_merge = true. It looks like it keeps getting reset back to false in the next run.

Terraform Version

Terraform v0.12.24
+ provider.github v2.8.0

Affected Resource(s)

  • github_repository

Terraform Configuration Files

resource "github_repository" "my_repo" {
  name                   = "my_repo"
  description            = "My Repo"
  default_branch         = "master"
  private                = true
  delete_branch_on_merge = true
}

Terraform Plan Output

  # github_repository.my_repo will be updated in-place
  ~ resource "github_repository" "my_repo" {
        allow_merge_commit     = true
        allow_rebase_merge     = true
        allow_squash_merge     = true
        archived               = false
        auto_init              = false
        default_branch         = "master"
      ~ delete_branch_on_merge = false -> true
        description            = "My Repo"
        etag                   = "<SOME_HASH>"
        full_name              = "<some-org>/my_repo"
        git_clone_url          = "git://github.com/<some-org>/my_repo.git"
        has_downloads          = false
        has_issues             = false
        has_projects           = false
        has_wiki               = false
        html_url               = "https://github.com/<some-org>/my-repo"
        http_clone_url         = "https://github.com/<some-org>/my-repo.git"
        id                     = "my_repo"
        is_template            = false
        name                   = "my_repo"
        node_id                = "<SOME_HASH>"
        private                = true
        ssh_clone_url          = "[email protected]:<some-org>/my-repo.git"
        svn_url                = "https://github.com/<some-org>/mh-repo"
        topics                 = []
    }

Expected Behavior

delete_branch_on_merge will be set to true and stays as true

Actual Behavior

      ~ delete_branch_on_merge = false -> true

This line keeps showing up in my plan, and the attribute is never set to true.

Steps to Reproduce

  1. Create a .hcl file like mentioned above (Note: not sure if it is related, but the repo was terraform import earlier)
  2. Run terraform plan and then terraform apply

Activity

  1. changed the title [-]`delete_branch_on_merge` doesn't stay as `true`[/-] [+]delete_branch_on_merge doesn't stay as true[/+] on May 29, 2020
  2. SanderKnape commented on May 30, 2020

    @SanderKnape

    I'm not able to reproduce this, either with a newly created repo from Terraform or with an imported repo. Same Terraform version and GitHub Provider version. Are you able to share a specific way to reproduce? Including what kind of initial settings to give the manually created repo and such.

  3. jcudit commented on May 30, 2020

    @jcudit
    Contributor

    My attempt linked above was also unsuccessful:

    $  while true; do sleep 1; terraform apply -auto-approve   -var "organization=${GITHUB_ORG}"   -var "github_token=${GITHUB_TOKEN}"; done
    github_repository.delete_branch_on_merge: Refreshing state... [id=delete_branch_on_merge]
    
    Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
    
    Outputs:
    
    repository = {
      "allow_merge_commit" = true
      "allow_rebase_merge" = true
      "allow_squash_merge" = true
      "archived" = false
      "default_branch" = "master"
      "delete_branch_on_merge" = true
      "description" = "A repository with delete-branch-on-merge configured"
      "etag" = "W/\"2952d2e5bb9de037e253a2b1e5427391\""
      "full_name" = "terraformtesting/delete_branch_on_merge"
      "git_clone_url" = "git://github.com/terraformtesting/delete_branch_on_merge.git"
      "has_downloads" = false
      "has_issues" = false
      "has_projects" = false
      "has_wiki" = false
      "homepage_url" = ""
      "html_url" = "https://github.com/terraformtesting/delete_branch_on_merge"
      "http_clone_url" = "https://github.com/terraformtesting/delete_branch_on_merge.git"
      "id" = "delete_branch_on_merge"
      "is_template" = false
      "name" = "delete_branch_on_merge"
      "node_id" = "MDEwOlJlcG9zaXRvcnkyNjgwOTk3OTI="
      "private" = true
      "ssh_clone_url" = "[email protected]:terraformtesting/delete_branch_on_merge.git"
      "svn_url" = "https://github.com/terraformtesting/delete_branch_on_merge"
      "template" = []
      "topics" = []
    }
    github_repository.delete_branch_on_merge: Refreshing state... [id=delete_branch_on_merge]
    
    Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
    
    Outputs:
    
    repository = {
      "allow_merge_commit" = true
      "allow_rebase_merge" = true
      "allow_squash_merge" = true
      "archived" = false
      "default_branch" = "master"
      "delete_branch_on_merge" = true
      "description" = "A repository with delete-branch-on-merge configured"
      "etag" = "W/\"c960bd0e68b2cac128cb53510e38fe09\""
      "full_name" = "terraformtesting/delete_branch_on_merge"
      "git_clone_url" = "git://github.com/terraformtesting/delete_branch_on_merge.git"
      "has_downloads" = false
      "has_issues" = false
      "has_projects" = false
      "has_wiki" = false
      "homepage_url" = ""
      "html_url" = "https://github.com/terraformtesting/delete_branch_on_merge"
      "http_clone_url" = "https://github.com/terraformtesting/delete_branch_on_merge.git"
      "id" = "delete_branch_on_merge"
      "is_template" = false
      "name" = "delete_branch_on_merge"
      "node_id" = "MDEwOlJlcG9zaXRvcnkyNjgwOTk3OTI="
      "private" = true
      "ssh_clone_url" = "[email protected]:terraformtesting/delete_branch_on_merge.git"
      "svn_url" = "https://github.com/terraformtesting/delete_branch_on_merge"
      "template" = []
      "topics" = []
    }
    github_repository.delete_branch_on_merge: Refreshing state... [id=delete_branch_on_merge]
    
    Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
  4. zmingxie commented on May 30, 2020

    @zmingxie
    Author

    This is odd... I was able to reproduce this all the time yesterday, but now I cannot reproduce it either.

    I'm going to close this issue now, and sorry about the false alarm.

    Thanks again!

  5. jcudit commented on May 30, 2020

    @jcudit
    Contributor

    No worries. If it happens again try adding a TF_LOG=DEBUG ... ahead of the terraform invocation as the added output may help.

  6. analytically commented on Jul 28, 2020

    @analytically

    Seeing this as well using 2.8.1.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions