[FEAT]: Allow renaming repositories without causing github_branch recreation #1926
Labels
hacktoberfest
Issues for participation in Hacktoberfest
Status: Up for grabs
Issues that are ready to be worked on by anyone
Type: Feature
New feature or request
Describe the need
Currently, if you create a repository and a branch, referencing the repository in the branch resource definition, you're unable to rename the repository without causing the branch to be recreated (destroyed and rebuilt). Example code below:
This is because the
github_branch
resource uses the repository name instead of the repository id, and repository is currently setup withForceNew
set totrue
. As a result, if you change the name of the repository, Terraform thinks it needs to destroy the existing branch and replace it with a new resource. Considering the repository itself hasn't changed, only the name, this is super undesirable behavior because Terraform will attempt to destroy a branch that may have commits already, or if the branch is protected, prevent Terraform from ever executing successfully to make the change.I propose that the
github_branch
resource optionally take a repository id or name, and only recreate the resource if the repository id has changed.SDK Version
No response
API Version
No response
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: