gitlab_branch_protection casuing replacment of resources rather then update in place
We being asked by security team to create gitlab policy which restricts deletion of branch protection rule. When we do it with GitLab UI its not a destructive activity , we can simply change the rule . but with terraform if we need to change role its destroy and create which is something blocking us . can we something about this. why its not a update in place ?
# module.oseng_wsus_repo.gitlab_branch_protection.master_branch_protection[0] must be replaced
-/+ resource "gitlab_branch_protection" "master_branch_protection" {
~ branch_protection_id = 334459 -> (known after apply)
~ id = "80278:master" -> (known after apply)
~ push_access_level = "maintainer" -> "no one" # forces replacement
# (6 unchanged attributes hidden)
}
# module.rhel7_images_repo.gitlab_branch_protection.master_branch_protection[0] must be replaced
-/+ resource "gitlab_branch_protection" "master_branch_protection" {
~ branch_protection_id = 334446 -> (known after apply)
~ id = "80281:master" -> (known after apply)
~ push_access_level = "maintainer" -> "no one" # forces replacement
# (6 unchanged attributes hidden)
}
Implementation Guide
- Follow the
CONTRIBUTING.mdguide for setting up your local development environment and clone the community fork of this project. - Amend the resource schema for
gitlab_branch_protectionto remove theRequiresReplaceplan modifiers frommerge_access_level,push_access_levelandunprotect_access_level. - Ensure all three attributes are updated successfully when changed with an acceptance test.
- Run
make reviewablebefore raising a merge request with your changes.
Edited by 🤖 GitLab Bot 🤖