Skip to content

delete_branch_on_merge isn't set, fails to stay true #536

Closed

Description

@mengesb

Terraform Version

0.13.0

Affected Resource(s)

Please list the resources as a list, for example:

  • github_repository

Terraform Configuration Files

resource github_repository r {
  lifecycle {
    ignore_changes = [default_branch]
  }

  name                   = var.name
  description            = var.description
  homepage_url           = var.homepage_url
  private                = var.private
  has_issues             = var.has_issues
  has_projects           = var.has_projects
  has_wiki               = var.has_wiki
  is_template            = var.is_template
  allow_merge_commit     = var.allow_merge_commit
  allow_squash_merge     = var.allow_squash_merge
  allow_rebase_merge     = var.allow_rebase_merge
  delete_branch_on_merge = var.delete_branch_on_merge
  has_downloads          = var.has_downloads
  auto_init              = var.auto_init
  gitignore_template     = var.gitignore_template
  license_template       = var.license_template
  archived               = var.archived
  topics                 = var.topics

  dynamic template {
    for_each = var.template == null ? {} : var.template

    content {
      owner      = template.value["owner"]
      repository = template.value["repository"]
    }
  }
}

Debug Output

terraform_apply-2020-54-26T01:54:56.log

Panic Output

N/A

Expected Behavior

Repository sets HEAD branch deletion after successful merge

Actual Behavior

Change not applied, persistently says that it needs to change delete_branch_on_merge setting

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
  2. terraform apply

Important Factoids

Running GitHub Enterprise Server 2.20.8

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

Activity

  1. mengesb commented on Aug 26, 2020

    @mengesb
    Author

    It seems the root of the issue might be GHES API or the provider's abstraction not picking up on delete_branch_on_merge. I can see the PATCH call from the debug log, and then on the subsequent read of the repository created, delete_branch_on_merge is not returned, thus it seems the provider assumes it is false

    The warning is fairly clear about the value changing and producing an inconsistent plan.

    I did verify on the GHES repo side - the option isn't changed. If I set it manually, it assumes it's false, whether I specify false or not; if it's true it assumes false, attempts to set it to true and still reads (assumes) false

  2. mengesb commented on Aug 26, 2020

    @mengesb
    Author

    I may have my own answer: https://enterprise.github.com/releases/2.21.0/notes

    Seems my version is one minor release too soon to have delete_branch_on_merge available from the API.

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