Skip to content

Access management

Configuring access management

Settings on existing principals (ADR-0005): group and project members, project shares, LDAP and SAML group links, job token allowlists, plus the remaining project deployment surfaces that declare references — remote mirrors, Pages domains, and deploy tokens.

Existing principals only

A declared member whose user does not exist, or a referenced project/group path that does not resolve, is an error in strict mode and a recorded skip in compatible mode, never an implicit creation. Undeclared members are not pruned; only declared memberships are managed.

Example access definition

gitlab_settings_groups:
  - path: platform
    members:
      - username: bob
        access_level: developer
        expires_at: "2027-01-01"
    ldap_group_links:
      - cn: gitlab-devs
        provider: main
        group_access: developer
    saml_group_links:
      - saml_group_name: Engineers
        access_level: maintainer

gitlab_settings_projects:
  - path: platform/service
    members:
      - username: alice
        access_level: maintainer
    shared_with_groups:
      - group: platform/qa
        group_access: reporter
    job_token_scope:
      enabled: true
      allowlist:
        - target_project: platform/tool
      groups_allowlist:
        - target_group: platform/ci
    remote_mirrors:
      - url: "https://user:{{ vault_mirror_token }}@mirror.example.com/repo.git"
        enabled: true
    pages_domains:
      - domain: www.example.com
        certificate: "{{ vault_pages_cert }}"
        key: "{{ vault_pages_key }}"
    deploy_tokens:
      - name: registry-reader
        scopes: [read_registry]
        expires_at: "2027-01-01T00:00:00Z"
        token_file: /var/lib/secrets/registry-reader.token

Access Management Spec

membersarray of objects

Group or project memberships for existing users. Memberships are matched by the resolved user id and are never implicitly pruned.

Properties of members

usernamestringRequired unless alternate identity is set

Existing GitLab username, resolved to a user id with exact matching. Declare exactly one of username or user_id.


user_idintegerRequired unless alternate identity is set

Existing GitLab user id. Declare exactly one of username or user_id.


access_levelstring or integerRequired on create or update

Stable role name (guest 10 through owner 50) or its integer value.


expires_atstring (date)

Optional membership expiry date; reconciles with drift detection.


statestring

Can be one of: present, absent. Default: present

Example:
members:
  - username: bob
    access_level: developer
  - username: departed-user
    state: absent
...

deploy_tokensarray of objects

Group or project deploy tokens. Tokens are immutable: converging drift recreates the token and rotates its one-time secret.

Properties of deploy_tokens

namestringRequired

Deploy-token identity.


scopesarray of stringsRequired on create

Token scopes. Drift recreates the token.

Accepted values for deploy_tokens[].scopes

read_repository — read the repository.

read_registry — pull container images.

write_registry — push container images.

read_package_registry — read packages.

write_package_registry — publish packages.

read_virtual_registry — read from a project virtual registry.

write_virtual_registry — publish through a project virtual registry.

At least one scope is required. The two virtual-registry scopes are project-only.


expires_atstring (date-time)

Token expiry. Drift recreates the token.


usernamestring

Optional deploy-token username. Drift recreates the token.


token_filestring (absolute path)

Controller path that receives the secret exactly once at creation; written 0600 and never logged.


statestring

Can be one of: present, absent. Default: present

Example:
deploy_tokens:
  - name: registry-reader
    scopes: [read_registry]
    token_file: /var/lib/secrets/registry-reader.token
...

projects[].shared_with_groupsarray of objects

Project shares with existing groups. Shares are add/remove only: changing access reports drift through strict/compatible handling, so remove and re-share to change it.

Properties of projects[].shared_with_groups

groupstringRequired unless alternate identity is set

Existing group path, resolved to an id. Declare exactly one of group or group_id.


group_idintegerRequired unless alternate identity is set

Existing group id. Declare exactly one of group or group_id.


group_accessstring or integerRequired on create

Stable access-level name or integer value.


statestring

Can be one of: present, absent. Default: present

Example:
shared_with_groups:
  - group: platform/qa
    group_access: reporter
...

groups[].ldap_group_linksarray of objects

LDAP group links, matched by their LDAP identity and provider. Links are add/remove only; removal sends the identity in the request body as required by GitLab's API.

Properties of groups[].ldap_group_links

cnstringRequired unless alternate identity is set

LDAP common name. Declare cn or filter.


filterstringRequired unless alternate identity is set

LDAP filter used instead of cn.


providerstringRequired

LDAP provider name; participates in composite matching.


group_accessstring or integerRequired on create

Stable access-level name or integer value.


statestring

Can be one of: present, absent. Default: present

Example:
ldap_group_links:
  - cn: gitlab-devs
    provider: main
    group_access: developer
...

groups[].saml_group_linksarray of objects

SAML group links. GitLab can store the same SAML group name under multiple providers; declare the provider to disambiguate those links. Links are add/remove only.

Properties of groups[].saml_group_links

saml_group_namestringRequired

SAML group name and primary identity.


providerstring

Optional provider used to disambiguate duplicate group names; carried on the item route for deletion.


access_levelstring or integerRequired on create

Stable access-level name or integer value.


statestring

Can be one of: present, absent. Default: present

Example:
saml_group_links:
  - saml_group_name: Engineers
    provider: corp
    access_level: maintainer
...

projects[].job_token_scope.allowlistarray of objects

Project entries admitted to the CI/CD job-token scope. Entries are add/remove only; the enabled toggle is documented in Integrations and Services.

Properties of projects[].job_token_scope.allowlist

target_projectstringRequired unless alternate identity is set

Existing project path, resolved to an id. Declare exactly one of target_project or target_project_id.


target_project_idintegerRequired unless alternate identity is set

Existing project id. Declare exactly one of target_project or target_project_id.


statestring

Can be one of: present, absent. Default: present

Example:
job_token_scope:
  allowlist:
    - target_project: platform/tool
...

projects[].job_token_scope.groups_allowlistarray of objects

Group entries admitted to the CI/CD job-token scope. Entries are add/remove only; the enabled toggle is documented in Integrations and Services.

Properties of projects[].job_token_scope.groups_allowlist

target_groupstringRequired unless alternate identity is set

Existing group path, resolved to an id. Declare exactly one of target_group or target_group_id.


target_group_idintegerRequired unless alternate identity is set

Existing group id. Declare exactly one of target_group or target_group_id.


statestring

Can be one of: present, absent. Default: present

Example:
job_token_scope:
  groups_allowlist:
    - target_group: platform/ci
      state: absent
...

projects[].remote_mirrorsarray of objects

Push mirrors matched by URL with embedded credentials stripped on both sides because GitLab masks them in responses. Rotate URL credentials by removing and recreating the mirror.

Properties of projects[].remote_mirrors

urlstringRequired

Mirror URL and identity. The full credentialed value is secret: never displayed, compared, or diffed, and carried on every ordinary update.


enabledboolean

Whether the mirror is active; reconciles with drift detection.


only_protected_branchesboolean

Mirror only protected branches; reconciles with drift detection.


keep_divergent_refsboolean

Keep divergent refs; reconciles with drift detection.


force_secret_updateboolean

Unsupported for mirror URLs because GitLab cannot safely replace credential-bearing URLs in place. Declare state: absent, apply, then declare the new URL.


statestring

Can be one of: present, absent. Default: present

Example:
remote_mirrors:
  - url: "https://user:{{ vault_token }}@mirror.example.com/repo.git"
    enabled: true
    only_protected_branches: true
...

projects[].pages_domainsarray of objects

Custom Pages domains matched by domain name.

Properties of projects[].pages_domains

domainstringRequired

Domain name and identity.


certificatestring

Write-mostly certificate material. GitLab reports expiration, not the material itself.


keystring

Write-mostly private-key material.


auto_ssl_enabledboolean

Whether GitLab manages the certificate through automatic SSL; reconciles with drift detection.


statestring

Can be one of: present, absent. Default: present

Example:
pages_domains:
  - domain: www.example.com
    certificate: "{{ vault_cert }}"
    key: "{{ vault_key }}"
...