Pulumi GitLab Provider

9.10.0 · active · verified Thu Apr 16

A Pulumi package for creating and managing GitLab resources. The `pulumi-gitlab` library allows users to define, deploy, and manage GitLab entities such as projects, groups, users, and CI/CD configurations using Python code. It is currently at version 9.10.0 and maintains a frequent release cadence, often with weekly or bi-weekly updates.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart program demonstrates how to create a GitLab group and a project within that group using Pulumi and Python. It assumes the `GITLAB_TOKEN` environment variable is set for authentication.

import pulumi
import pulumi_gitlab as gitlab
import os

# Configure the GitLab token using an environment variable.
# Alternatively, use `pulumi config set gitlab:token <YOUR_TOKEN> --secret`
# os.environ.get('GITLAB_TOKEN') should contain a valid GitLab Personal Access Token
# with appropriate scopes (e.g., 'api', 'read_repository', 'write_repository').

# Create a new GitLab Group
example_group = gitlab.Group("example-group",
    name="my-pulumi-managed-group",
    path="my-pulumi-managed-group",
    description="Managed by Pulumi",
    visibility_level="private"
)

# Create a new GitLab Project within the group
example_project = gitlab.Project("example-project",
    name="my-pulumi-managed-project",
    description="My awesome project managed by Pulumi.",
    namespace_id=example_group.id,
    visibility_level="private",
    initialize_with_readme=True
)

pulumi.export("group_url", example_group.web_url)
pulumi.export("project_url", example_project.web_url)

view raw JSON →