Add admin_role and admin_role_attachment resources
What does this MR do?
Adds support for GitLab custom admin roles.
READ_ADMIN_* permissions were listed as valid enabled_permissions values on gitlab_member_role, but GitLab's GraphQL API always rejected them at runtime with Unknown permission: ..., since they belong to a separate admin-role mutation, not the member-role one.
Changes
- New resource
gitlab_admin_role: manages instance-wide custom admin roles (memberRoleAdminCreate/Update/Delete). Nobase_access_level/group_path, since admin roles aren't namespace-scoped. Self-managed only. - New resource
gitlab_admin_role_attachment: assigns agitlab_admin_roleto a user (memberRoleToUserAssign). Note: the GitLab API has no query to look up a user's current admin role, soReadcan only detect that the user or role was deleted, not that the assignment itself changed externally, documented in the resource description. gitlab_member_role: removedREAD_ADMIN_CICD,READ_ADMIN_GROUPS,READ_ADMIN_MONITORING,READ_ADMIN_PROJECTS,READ_ADMIN_SUBSCRIPTION,READ_ADMIN_USERS,READ_ADMIN_DASHBOARDfrom validenabled_permissions(never worked, usegitlab_admin_roleinstead) and the associated dead SaaS-blocking code path.
How to test
resource "gitlab_admin_role" "auditor" {
name = "Auditor"
enabled_permissions = ["READ_ADMIN_USERS", "READ_ADMIN_CICD"]
}
resource "gitlab_admin_role_attachment" "example" {
user_id = gitlab_user.example.id
admin_role_id = gitlab_admin_role.auditor.id
}Requires a self-managed Ultimate instance (GitLab 18.3+, custom admin roles GA).
Changelog: Feature
Closes #6842 (closed)