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

Do not destroy the repository when you change the repository name #616

Closed
smorimoto opened this issue Dec 2, 2020 · 13 comments
Closed

Do not destroy the repository when you change the repository name #616

smorimoto opened this issue Dec 2, 2020 · 13 comments
Labels
r/repository Type: Bug Something isn't working as documented

Comments

@smorimoto
Copy link

Is this intentional?

@jcudit
Copy link
Contributor

jcudit commented Dec 3, 2020

Unintentional. We should support renaming a repository without having to destroy it. Will track this for the next batch of repository resource updates.

@jcudit jcudit added Type: Bug Something isn't working as documented r/repository labels Dec 3, 2020
@smorimoto
Copy link
Author

I also changed the local name at the same time, is that probably the cause? Ideally, even if you change both the local name and the repository name, it should not be destroyed.

@k24dizzle
Copy link
Contributor

Hi, I went ahead and gave this a shot here: #699. Would appreciate any feedback!

@smorimoto
Copy link
Author

Cool, I will take a look at it when I have much spare time 🙂

@majormoses
Copy link
Contributor

majormoses commented Mar 23, 2021

This is actually quite an old issue and something that was not exactly intentional and more a set of unfortunate set of limitations of the (documented) api. See #55 for more information. I am excited to see this be a thing as I know it's come up a number of times at my org and it was always way more work then it should be to rename a resource.

@k24dizzle
Copy link
Contributor

Seems like the main issue here is that the github_repository resource uses the name as the id of the resource, which we want to change, rather than the repo_id which shouldn't change.

I wonder how far we could get by removing the ForceNew attribute from the name field. In my testing (in my PR above), removing that allows you to rename a repository. Behind the scenes, it will assign the resource a new id, since there is a new name, but are there any implications of changing the id of a terraform resource?

cc: @jcudit

@jcudit
Copy link
Contributor

jcudit commented Apr 6, 2021

Removing (or making configurable) the ForceNew is a reasonable first step to get this functionality. My worry too is with unforeseen effects of changing the ID of a repository resource. I recommend we enable this behaviour defaulted to off so that consumers can test or ignore the feature at their judgement.

Aiming to land some suggestions on the attached PR to keep it moving.

@devinrsmith
Copy link

I think this issues has been fixed by #699

I've planned out a run, and now I see github_repository being updated in-place :)

Unfortunately, I think there are a lot of other resources that reference the repository name, and would be better served by referencing a repository id (#744).

From our own usage, we see the following resources planned to be destroyed during a repo rename: github_branch, github_branch_default, github_branch_protection_v3, github_repository_collaborator, and github_team_repository. (There are probably other relevant resources that need to be updated, that we don't use.)

I'm assuming I'll need to go through a rename and manual import step instead of a normal terraform apply to resolve this currently.

@jcudit
Copy link
Contributor

jcudit commented May 11, 2021

Thanks for pointing this out. I'll get #744 prioritized.

@github-actions
Copy link

github-actions bot commented Dec 7, 2022

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Status: Stale Used by stalebot to clean house label Dec 7, 2022
@github-actions github-actions bot removed the Status: Stale Used by stalebot to clean house label Dec 8, 2022
@Caleb-Hoffman
Copy link

Hi @kfcampbell, just curious if there are any updates on this?

@mwarkentin
Copy link
Contributor

@Caleb-Hoffman according to #55 I think this might be resolved?

@kfcampbell
Copy link
Member

Closing as #55 is closed; please let me know if this is not the case.

@kfcampbell kfcampbell closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r/repository Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

8 participants