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

Renaming labels creates new labels. #173

Closed
eliasbrange opened this issue Dec 20, 2018 · 2 comments · Fixed by #288
Closed

Renaming labels creates new labels. #173

eliasbrange opened this issue Dec 20, 2018 · 2 comments · Fixed by #288
Labels
Type: Bug Something isn't working as documented

Comments

@eliasbrange
Copy link

Terraform version: v0.11.8
Provider version: v1.3.0

Problem

It seems like when changing the name property on a label the provider creates a new label with the new name and leaves the old one intact.

Cause

The reason for this is due to the implementation in https://github.com/terraform-providers/terraform-provider-github/blob/master/github/resource_github_issue_label.go.

In resourceGithubIssueLabelCreateOrUpdate the following flow is used:

Check if newName is a label, if it is update it and if it isn't create a new one. The problem here is that the original name is not the one that is checked. So if a label is changed in terraform from label1 and label2, github is searched for label2, which does not exist yet so a new label is created and the old label1 is left behind.

Solution

When checking for existence, the original name should be used.

@kuwas
Copy link

kuwas commented Aug 30, 2019

Would be ideal if there was an authoritative labels resource, using something like the dynamic blocks introduced in 0.12, each block is a label. Any labels not found in the supplied list will be removed.

shouichi added a commit to shouichi/terraform-provider-github that referenced this issue Oct 21, 2019
@php-coder
Copy link

It would be great to get it fixed given that there are already 2 PRs for that.

shouichi added a commit to shouichi/terraform-provider-github that referenced this issue Mar 3, 2020
shouichi added a commit to shouichi/terraform-provider-github that referenced this issue Mar 3, 2020
jcudit pushed a commit to terraformtesting/terraform-provider-github that referenced this issue Mar 3, 2020
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this issue Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented
Projects
None yet
4 participants