Allow adding groups and users in gitlab_tag_protection
Created by: r3nic1e
Feature Description
gitlab_tag_protection allows only no one, developer or maintainer as create_access_level. But via GitLab we can set custom groups and users there.
gitlab_branch_protection already supports the same: https://github.com/gitlabhq/terraform-provider-gitlab/pull/556
Do you want to implement this?
-
I would like to implement this myself 👷
Implementation Details
Implementing this issue will require several updates to the resource_gitlab_branch_protection.go file, including:
- Update the schema block to include two new attributes:
-
group_id, which accepts an integer -
user_id, which accepts an integer -
access_level, which accepts an enumerated string that resolved to an integer (I.e.,maintainersresolves to 40,developers+maintainersresolves to 30, etc)
-
- Adds validation ensuring that
group_idanduser_idare mutually exclusive, and that when either are present,access_levelis provided as well. This can be implemented by creating a new validation function and using it onaccess_level - Updating the CRUD functions to accept the new inputs
- Creating several tests to ensure that the new values work appropriately, including:
- create a test using
group_idandaccess_leveland ensure it works properly - create a test using
user_idandaccess_leveland ensure it works properly - create a test with both
user_idandgroup_idand ensure it errors properly - create a test with
user_id, but missingaccess_level, and ensure it errors properly
- create a test using
Edited by Patrick Rice