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

[BUG]: github_branch_default resource fails on creation with rename set to true #1904

Open
1 task done
stefan-hartmann-lgs opened this issue Sep 18, 2023 · 2 comments · May be fixed by #2428
Open
1 task done

[BUG]: github_branch_default resource fails on creation with rename set to true #1904

stefan-hartmann-lgs opened this issue Sep 18, 2023 · 2 comments · May be fixed by #2428
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@stefan-hartmann-lgs
Copy link

stefan-hartmann-lgs commented Sep 18, 2023

Expected Behavior

If I have the following terraform config ...

resource "github_repository" "example" {
  name        = "example"
  auto_init   = true
}

resource "github_branch_default" "default"{
  repository = github_repository.example.name
  branch     = "main"
  rename     = true
}

... I expect the github_default_branch resource being created without issues.

Actual Behavior

The terraform plan succeeds without issues BUT on the terraform apply aka the creation of the github_default_branch resource an API call is made to rename the default branch from main to main. This API call fails with status code 422.

Doing an API call to rename main to main does not really make sense, fails and is an additional call which is not required.

A small condition only doing the rename-call if it makes sense would fix the issue aka if current_name != new_name.

See:

Terraform Version

Terraform v1.5.7
on linux_amd64

  • provider registry.terraform.io/integrations/github v5.36.0

Affected Resource(s)

  • github_branch_default

Terraform Configuration Files

No response

Steps to Reproduce

No response

Debug Output

No response

Panic Output

image

Code of Conduct

  • I agree to follow this project's Code of Conduct
@stefan-hartmann-lgs stefan-hartmann-lgs added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Sep 18, 2023
@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone and removed Status: Triage This is being looked at and prioritized labels Oct 20, 2023
@stefan-hartmann-lgs
Copy link
Author

Any updates on this one?

@dreinhardt89
Copy link

dreinhardt89 commented Apr 22, 2024

This currently blocks you from adding the rename attribute to an existing default branch.

@CEbbinghaus CEbbinghaus linked a pull request Oct 15, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants