Skip to content

entrepot_role_binding

Grants a role to a subject on the repositories matching a pattern. Bindings are immutable: changing any attribute replaces the binding.

Subjects are users (OIDC usernames, or sa:<name> for service accounts — use entrepot_service_account.<x>.username), OIDC groups, GitLab trust policies, or every authenticated principal.

# Let the CI service account publish to every npm-* repository.
resource "entrepot_role_binding" "ci_npm" {
role = entrepot_role.publisher.name
subject_type = "user"
subject = entrepot_service_account.ci.username # "sa:ci"
repository_pattern = "npm-*"
}
# Members of the OIDC group "platform-admins" administer the whole server.
resource "entrepot_role_binding" "admins" {
role = "admin"
subject_type = "group"
subject = "platform-admins"
}
# Every signed-in user can read the public-* repositories.
resource "entrepot_role_binding" "readers" {
role = "viewer"
subject_type = "authenticated"
repository_pattern = "public-*"
}
# GitLab CI jobs matching a trust policy can upload to the internal repositories.
resource "entrepot_role_binding" "gitlab_ci" {
role = "developer"
subject_type = "gitlab_policy"
subject = entrepot_gitlab_trust_policy.platform.name
repository_pattern = "internal-*"
}
  • role (String) Role name: a built-in role (viewer, developer, maintainer, admin) or an entrepot_role. Changing it forces a new binding.
  • subject_type (String) user, group (OIDC group), gitlab_policy (an entrepot_gitlab_trust_policy) or authenticated (anyone who is signed in). Changing it forces a new binding.
  • repository_pattern (String) Glob over repository names (default *, all repositories). A role with admin on * grants system administration. Changing it forces a new binding.
  • subject (String) Username (sa:<name> for service accounts), group name or trust policy name. Required unless subject_type = "authenticated", where it must be omitted. Changing it forces a new binding.
  • created_at (String) Creation time (RFC 3339).
  • id (String) Server-assigned binding ID (used for import).

The terraform import command can be used, for example:

Terminal window
# Role bindings are imported by their ID (see GET /api/v1/role-bindings).
terraform import entrepot_role_binding.ci_npm 3f2b8f1e-6a0c-4f43-9f57-2d7f4b1c9e10

Resource documentation generated from the provider’s schema (docs/resources/role_binding.md in terraform-provider-entrepot).