Renaming a group (or project) label triggers a replacement, it should update the label in-place instead
Changing an existing gitlab_group_label's name
resource "gitlab_group_label" "some_label" {
group = "0123456"
- name = "awful_name"
+ name = "beautiful_name"
}
Would generate this plan:
# gitlab_group_label.some_label must be replaced
-/+ resource "gitlab_group_label" "some_label" {
~ id = "0123456:78901234" -> (known after apply)
~ label_id = 42424242 -> (known after apply)
~ name = "awful_name" -> "beautiful_name" # forces replacement
# (X unchanged attributes hidden)
}
Where I would expect:
# gitlab_group_label.some_label will be updated in-place
~ resource "gitlab_group_label" "some_label" {
~ name = "awful_name" -> "beautiful_name"
id = "0123456:78901234"
# (X unchanged attributes hidden)
}
Implementation Guide
See Patricks comment in #5447 (comment 1532781829).
The idea is to use the label id as a Terraform resource id instead of the label name. This needs a schema change and with that a state migration:
- Register a new schema version
V1for the resource. - Implement a new state migration to move from schema
V0(the present one with thenameid) toV1(the new one withidas id). - Test & Document
An example of a state migration can be found in this resource.
The same applies to the project label resource and they can be done at the same time.
Edited by Francis St-Amour