Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mengesb opened this issue Aug 26, 2020 · 2 comments
Closed

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

mengesb opened this issue Aug 26, 2020 · 2 comments

Comments

@mengesb
Copy link

mengesb commented Aug 26, 2020

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:

@mengesb
Copy link
Author

mengesb commented Aug 26, 2020

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

@mengesb
Copy link
Author

mengesb commented Aug 26, 2020

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant