1. Packages
  2. Sonarqube Provider
  3. API Docs
  4. GitlabBinding
sonarqube 0.16.14 published on Monday, Apr 14, 2025 by jdamata

sonarqube.GitlabBinding

Explore with Pulumi AI

Provides a Sonarqube GitLab binding resource. This can be used to create and manage the binding between a GitLab repository and a SonarQube project

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as sonarqube from "@pulumi/sonarqube";

const gitlab_alm = new sonarqube.AlmGitlab("gitlab-alm", {
    key: "myalm",
    personalAccessToken: "my_personal_access_token",
    url: "https://gitlab.com/api/v4",
});
const main = new sonarqube.Project("main", {
    project: "my_project",
    visibility: "public",
});
const gitlab_binding = new sonarqube.GitlabBinding("gitlab-binding", {
    almSetting: gitlab_alm.key,
    project: "my_project",
    repository: "123",
});
Copy
import pulumi
import pulumi_sonarqube as sonarqube

gitlab_alm = sonarqube.AlmGitlab("gitlab-alm",
    key="myalm",
    personal_access_token="my_personal_access_token",
    url="https://gitlab.com/api/v4")
main = sonarqube.Project("main",
    project="my_project",
    visibility="public")
gitlab_binding = sonarqube.GitlabBinding("gitlab-binding",
    alm_setting=gitlab_alm.key,
    project="my_project",
    repository="123")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/sonarqube/sonarqube"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		gitlab_alm, err := sonarqube.NewAlmGitlab(ctx, "gitlab-alm", &sonarqube.AlmGitlabArgs{
			Key:                 pulumi.String("myalm"),
			PersonalAccessToken: pulumi.String("my_personal_access_token"),
			Url:                 pulumi.String("https://gitlab.com/api/v4"),
		})
		if err != nil {
			return err
		}
		_, err = sonarqube.NewProject(ctx, "main", &sonarqube.ProjectArgs{
			Project:    pulumi.String("my_project"),
			Visibility: pulumi.String("public"),
		})
		if err != nil {
			return err
		}
		_, err = sonarqube.NewGitlabBinding(ctx, "gitlab-binding", &sonarqube.GitlabBindingArgs{
			AlmSetting: gitlab_alm.Key,
			Project:    pulumi.String("my_project"),
			Repository: pulumi.String("123"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Sonarqube = Pulumi.Sonarqube;

return await Deployment.RunAsync(() => 
{
    var gitlab_alm = new Sonarqube.AlmGitlab("gitlab-alm", new()
    {
        Key = "myalm",
        PersonalAccessToken = "my_personal_access_token",
        Url = "https://gitlab.com/api/v4",
    });

    var main = new Sonarqube.Project("main", new()
    {
        Project = "my_project",
        Visibility = "public",
    });

    var gitlab_binding = new Sonarqube.GitlabBinding("gitlab-binding", new()
    {
        AlmSetting = gitlab_alm.Key,
        Project = "my_project",
        Repository = "123",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sonarqube.AlmGitlab;
import com.pulumi.sonarqube.AlmGitlabArgs;
import com.pulumi.sonarqube.Project;
import com.pulumi.sonarqube.ProjectArgs;
import com.pulumi.sonarqube.GitlabBinding;
import com.pulumi.sonarqube.GitlabBindingArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var gitlab_alm = new AlmGitlab("gitlab-alm", AlmGitlabArgs.builder()
            .key("myalm")
            .personalAccessToken("my_personal_access_token")
            .url("https://gitlab.com/api/v4")
            .build());

        var main = new Project("main", ProjectArgs.builder()
            .project("my_project")
            .visibility("public")
            .build());

        var gitlab_binding = new GitlabBinding("gitlab-binding", GitlabBindingArgs.builder()
            .almSetting(gitlab_alm.key())
            .project("my_project")
            .repository("123")
            .build());

    }
}
Copy
resources:
  gitlab-alm:
    type: sonarqube:AlmGitlab
    properties:
      key: myalm
      personalAccessToken: my_personal_access_token
      url: https://gitlab.com/api/v4
  main:
    type: sonarqube:Project
    properties:
      project: my_project
      visibility: public
  gitlab-binding:
    type: sonarqube:GitlabBinding
    properties:
      almSetting: ${["gitlab-alm"].key}
      project: my_project
      repository: '123'
Copy

Create GitlabBinding Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new GitlabBinding(name: string, args: GitlabBindingArgs, opts?: CustomResourceOptions);
@overload
def GitlabBinding(resource_name: str,
                  args: GitlabBindingArgs,
                  opts: Optional[ResourceOptions] = None)

@overload
def GitlabBinding(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  alm_setting: Optional[str] = None,
                  project: Optional[str] = None,
                  repository: Optional[str] = None,
                  gitlab_binding_id: Optional[str] = None,
                  monorepo: Optional[str] = None)
func NewGitlabBinding(ctx *Context, name string, args GitlabBindingArgs, opts ...ResourceOption) (*GitlabBinding, error)
public GitlabBinding(string name, GitlabBindingArgs args, CustomResourceOptions? opts = null)
public GitlabBinding(String name, GitlabBindingArgs args)
public GitlabBinding(String name, GitlabBindingArgs args, CustomResourceOptions options)
type: sonarqube:GitlabBinding
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. GitlabBindingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. GitlabBindingArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. GitlabBindingArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. GitlabBindingArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. GitlabBindingArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var gitlabBindingResource = new Sonarqube.GitlabBinding("gitlabBindingResource", new()
{
    AlmSetting = "string",
    Project = "string",
    Repository = "string",
    GitlabBindingId = "string",
    Monorepo = "string",
});
Copy
example, err := sonarqube.NewGitlabBinding(ctx, "gitlabBindingResource", &sonarqube.GitlabBindingArgs{
	AlmSetting:      pulumi.String("string"),
	Project:         pulumi.String("string"),
	Repository:      pulumi.String("string"),
	GitlabBindingId: pulumi.String("string"),
	Monorepo:        pulumi.String("string"),
})
Copy
var gitlabBindingResource = new GitlabBinding("gitlabBindingResource", GitlabBindingArgs.builder()
    .almSetting("string")
    .project("string")
    .repository("string")
    .gitlabBindingId("string")
    .monorepo("string")
    .build());
Copy
gitlab_binding_resource = sonarqube.GitlabBinding("gitlabBindingResource",
    alm_setting="string",
    project="string",
    repository="string",
    gitlab_binding_id="string",
    monorepo="string")
Copy
const gitlabBindingResource = new sonarqube.GitlabBinding("gitlabBindingResource", {
    almSetting: "string",
    project: "string",
    repository: "string",
    gitlabBindingId: "string",
    monorepo: "string",
});
Copy
type: sonarqube:GitlabBinding
properties:
    almSetting: string
    gitlabBindingId: string
    monorepo: string
    project: string
    repository: string
Copy

GitlabBinding Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The GitlabBinding resource accepts the following input properties:

AlmSetting This property is required. string
GitLab ALM setting key
Project This property is required. string
SonarQube project key. Changing this will force a new resource to be created
Repository This property is required. string
The GitLab project ID
GitlabBindingId string
The ID of this resource.
Monorepo string
Is this project part of a monorepo. Default value: false
AlmSetting This property is required. string
GitLab ALM setting key
Project This property is required. string
SonarQube project key. Changing this will force a new resource to be created
Repository This property is required. string
The GitLab project ID
GitlabBindingId string
The ID of this resource.
Monorepo string
Is this project part of a monorepo. Default value: false
almSetting This property is required. String
GitLab ALM setting key
project This property is required. String
SonarQube project key. Changing this will force a new resource to be created
repository This property is required. String
The GitLab project ID
gitlabBindingId String
The ID of this resource.
monorepo String
Is this project part of a monorepo. Default value: false
almSetting This property is required. string
GitLab ALM setting key
project This property is required. string
SonarQube project key. Changing this will force a new resource to be created
repository This property is required. string
The GitLab project ID
gitlabBindingId string
The ID of this resource.
monorepo string
Is this project part of a monorepo. Default value: false
alm_setting This property is required. str
GitLab ALM setting key
project This property is required. str
SonarQube project key. Changing this will force a new resource to be created
repository This property is required. str
The GitLab project ID
gitlab_binding_id str
The ID of this resource.
monorepo str
Is this project part of a monorepo. Default value: false
almSetting This property is required. String
GitLab ALM setting key
project This property is required. String
SonarQube project key. Changing this will force a new resource to be created
repository This property is required. String
The GitLab project ID
gitlabBindingId String
The ID of this resource.
monorepo String
Is this project part of a monorepo. Default value: false

Outputs

All input properties are implicitly available as output properties. Additionally, the GitlabBinding resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing GitlabBinding Resource

Get an existing GitlabBinding resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: GitlabBindingState, opts?: CustomResourceOptions): GitlabBinding
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        alm_setting: Optional[str] = None,
        gitlab_binding_id: Optional[str] = None,
        monorepo: Optional[str] = None,
        project: Optional[str] = None,
        repository: Optional[str] = None) -> GitlabBinding
func GetGitlabBinding(ctx *Context, name string, id IDInput, state *GitlabBindingState, opts ...ResourceOption) (*GitlabBinding, error)
public static GitlabBinding Get(string name, Input<string> id, GitlabBindingState? state, CustomResourceOptions? opts = null)
public static GitlabBinding get(String name, Output<String> id, GitlabBindingState state, CustomResourceOptions options)
resources:  _:    type: sonarqube:GitlabBinding    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AlmSetting string
GitLab ALM setting key
GitlabBindingId string
The ID of this resource.
Monorepo string
Is this project part of a monorepo. Default value: false
Project string
SonarQube project key. Changing this will force a new resource to be created
Repository string
The GitLab project ID
AlmSetting string
GitLab ALM setting key
GitlabBindingId string
The ID of this resource.
Monorepo string
Is this project part of a monorepo. Default value: false
Project string
SonarQube project key. Changing this will force a new resource to be created
Repository string
The GitLab project ID
almSetting String
GitLab ALM setting key
gitlabBindingId String
The ID of this resource.
monorepo String
Is this project part of a monorepo. Default value: false
project String
SonarQube project key. Changing this will force a new resource to be created
repository String
The GitLab project ID
almSetting string
GitLab ALM setting key
gitlabBindingId string
The ID of this resource.
monorepo string
Is this project part of a monorepo. Default value: false
project string
SonarQube project key. Changing this will force a new resource to be created
repository string
The GitLab project ID
alm_setting str
GitLab ALM setting key
gitlab_binding_id str
The ID of this resource.
monorepo str
Is this project part of a monorepo. Default value: false
project str
SonarQube project key. Changing this will force a new resource to be created
repository str
The GitLab project ID
almSetting String
GitLab ALM setting key
gitlabBindingId String
The ID of this resource.
monorepo String
Is this project part of a monorepo. Default value: false
project String
SonarQube project key. Changing this will force a new resource to be created
repository String
The GitLab project ID

Package Details

Repository
sonarqube jdamata/terraform-provider-sonarqube
License
Notes
This Pulumi package is based on the sonarqube Terraform Provider.