1. Packages
  2. Gitlab Provider
  3. API Docs
  4. IntegrationGithub
GitLab v8.10.0 published on Friday, Mar 21, 2025 by Pulumi

gitlab.IntegrationGithub

Explore with Pulumi AI

The gitlab.IntegrationGithub resource allows to manage the lifecycle of a project integration with GitHub.

This resource requires a GitLab Enterprise instance.

Upstream API: GitLab REST API docs

Example Usage

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

const awesomeProject = new gitlab.Project("awesome_project", {
    name: "awesome_project",
    description: "My awesome project.",
    visibilityLevel: "public",
});
const github = new gitlab.IntegrationGithub("github", {
    project: awesomeProject.id,
    token: "REDACTED",
    repositoryUrl: "https://github.com/gitlabhq/terraform-provider-gitlab",
});
Copy
import pulumi
import pulumi_gitlab as gitlab

awesome_project = gitlab.Project("awesome_project",
    name="awesome_project",
    description="My awesome project.",
    visibility_level="public")
github = gitlab.IntegrationGithub("github",
    project=awesome_project.id,
    token="REDACTED",
    repository_url="https://github.com/gitlabhq/terraform-provider-gitlab")
Copy
package main

import (
	"github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		awesomeProject, err := gitlab.NewProject(ctx, "awesome_project", &gitlab.ProjectArgs{
			Name:            pulumi.String("awesome_project"),
			Description:     pulumi.String("My awesome project."),
			VisibilityLevel: pulumi.String("public"),
		})
		if err != nil {
			return err
		}
		_, err = gitlab.NewIntegrationGithub(ctx, "github", &gitlab.IntegrationGithubArgs{
			Project:       awesomeProject.ID(),
			Token:         pulumi.String("REDACTED"),
			RepositoryUrl: pulumi.String("https://github.com/gitlabhq/terraform-provider-gitlab"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;

return await Deployment.RunAsync(() => 
{
    var awesomeProject = new GitLab.Project("awesome_project", new()
    {
        Name = "awesome_project",
        Description = "My awesome project.",
        VisibilityLevel = "public",
    });

    var github = new GitLab.IntegrationGithub("github", new()
    {
        Project = awesomeProject.Id,
        Token = "REDACTED",
        RepositoryUrl = "https://github.com/gitlabhq/terraform-provider-gitlab",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.Project;
import com.pulumi.gitlab.ProjectArgs;
import com.pulumi.gitlab.IntegrationGithub;
import com.pulumi.gitlab.IntegrationGithubArgs;
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 awesomeProject = new Project("awesomeProject", ProjectArgs.builder()
            .name("awesome_project")
            .description("My awesome project.")
            .visibilityLevel("public")
            .build());

        var github = new IntegrationGithub("github", IntegrationGithubArgs.builder()
            .project(awesomeProject.id())
            .token("REDACTED")
            .repositoryUrl("https://github.com/gitlabhq/terraform-provider-gitlab")
            .build());

    }
}
Copy
resources:
  awesomeProject:
    type: gitlab:Project
    name: awesome_project
    properties:
      name: awesome_project
      description: My awesome project.
      visibilityLevel: public
  github:
    type: gitlab:IntegrationGithub
    properties:
      project: ${awesomeProject.id}
      token: REDACTED
      repositoryUrl: https://github.com/gitlabhq/terraform-provider-gitlab
Copy

Create IntegrationGithub Resource

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

Constructor syntax

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

@overload
def IntegrationGithub(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      project: Optional[str] = None,
                      repository_url: Optional[str] = None,
                      token: Optional[str] = None,
                      static_context: Optional[bool] = None)
func NewIntegrationGithub(ctx *Context, name string, args IntegrationGithubArgs, opts ...ResourceOption) (*IntegrationGithub, error)
public IntegrationGithub(string name, IntegrationGithubArgs args, CustomResourceOptions? opts = null)
public IntegrationGithub(String name, IntegrationGithubArgs args)
public IntegrationGithub(String name, IntegrationGithubArgs args, CustomResourceOptions options)
type: gitlab:IntegrationGithub
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. IntegrationGithubArgs
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. IntegrationGithubArgs
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. IntegrationGithubArgs
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. IntegrationGithubArgs
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. IntegrationGithubArgs
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 integrationGithubResource = new GitLab.IntegrationGithub("integrationGithubResource", new()
{
    Project = "string",
    RepositoryUrl = "string",
    Token = "string",
    StaticContext = false,
});
Copy
example, err := gitlab.NewIntegrationGithub(ctx, "integrationGithubResource", &gitlab.IntegrationGithubArgs{
	Project:       pulumi.String("string"),
	RepositoryUrl: pulumi.String("string"),
	Token:         pulumi.String("string"),
	StaticContext: pulumi.Bool(false),
})
Copy
var integrationGithubResource = new IntegrationGithub("integrationGithubResource", IntegrationGithubArgs.builder()
    .project("string")
    .repositoryUrl("string")
    .token("string")
    .staticContext(false)
    .build());
Copy
integration_github_resource = gitlab.IntegrationGithub("integrationGithubResource",
    project="string",
    repository_url="string",
    token="string",
    static_context=False)
Copy
const integrationGithubResource = new gitlab.IntegrationGithub("integrationGithubResource", {
    project: "string",
    repositoryUrl: "string",
    token: "string",
    staticContext: false,
});
Copy
type: gitlab:IntegrationGithub
properties:
    project: string
    repositoryUrl: string
    staticContext: false
    token: string
Copy

IntegrationGithub 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 IntegrationGithub resource accepts the following input properties:

Project
This property is required.
Changes to this property will trigger replacement.
string
ID of the project you want to activate integration on.
RepositoryUrl This property is required. string
Token This property is required. string
A GitHub personal access token with at least repo:status scope.
StaticContext bool
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.
Project
This property is required.
Changes to this property will trigger replacement.
string
ID of the project you want to activate integration on.
RepositoryUrl This property is required. string
Token This property is required. string
A GitHub personal access token with at least repo:status scope.
StaticContext bool
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.
project
This property is required.
Changes to this property will trigger replacement.
String
ID of the project you want to activate integration on.
repositoryUrl This property is required. String
token This property is required. String
A GitHub personal access token with at least repo:status scope.
staticContext Boolean
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.
project
This property is required.
Changes to this property will trigger replacement.
string
ID of the project you want to activate integration on.
repositoryUrl This property is required. string
token This property is required. string
A GitHub personal access token with at least repo:status scope.
staticContext boolean
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.
project
This property is required.
Changes to this property will trigger replacement.
str
ID of the project you want to activate integration on.
repository_url This property is required. str
token This property is required. str
A GitHub personal access token with at least repo:status scope.
static_context bool
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.
project
This property is required.
Changes to this property will trigger replacement.
String
ID of the project you want to activate integration on.
repositoryUrl This property is required. String
token This property is required. String
A GitHub personal access token with at least repo:status scope.
staticContext Boolean
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.

Outputs

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

Active bool
Whether the integration is active.
CreatedAt string
Create time.
Id string
The provider-assigned unique ID for this managed resource.
Title string
Title.
UpdatedAt string
Update time.
Active bool
Whether the integration is active.
CreatedAt string
Create time.
Id string
The provider-assigned unique ID for this managed resource.
Title string
Title.
UpdatedAt string
Update time.
active Boolean
Whether the integration is active.
createdAt String
Create time.
id String
The provider-assigned unique ID for this managed resource.
title String
Title.
updatedAt String
Update time.
active boolean
Whether the integration is active.
createdAt string
Create time.
id string
The provider-assigned unique ID for this managed resource.
title string
Title.
updatedAt string
Update time.
active bool
Whether the integration is active.
created_at str
Create time.
id str
The provider-assigned unique ID for this managed resource.
title str
Title.
updated_at str
Update time.
active Boolean
Whether the integration is active.
createdAt String
Create time.
id String
The provider-assigned unique ID for this managed resource.
title String
Title.
updatedAt String
Update time.

Look up Existing IntegrationGithub Resource

Get an existing IntegrationGithub 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?: IntegrationGithubState, opts?: CustomResourceOptions): IntegrationGithub
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        active: Optional[bool] = None,
        created_at: Optional[str] = None,
        project: Optional[str] = None,
        repository_url: Optional[str] = None,
        static_context: Optional[bool] = None,
        title: Optional[str] = None,
        token: Optional[str] = None,
        updated_at: Optional[str] = None) -> IntegrationGithub
func GetIntegrationGithub(ctx *Context, name string, id IDInput, state *IntegrationGithubState, opts ...ResourceOption) (*IntegrationGithub, error)
public static IntegrationGithub Get(string name, Input<string> id, IntegrationGithubState? state, CustomResourceOptions? opts = null)
public static IntegrationGithub get(String name, Output<String> id, IntegrationGithubState state, CustomResourceOptions options)
resources:  _:    type: gitlab:IntegrationGithub    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:
Active bool
Whether the integration is active.
CreatedAt string
Create time.
Project Changes to this property will trigger replacement. string
ID of the project you want to activate integration on.
RepositoryUrl string
StaticContext bool
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.
Title string
Title.
Token string
A GitHub personal access token with at least repo:status scope.
UpdatedAt string
Update time.
Active bool
Whether the integration is active.
CreatedAt string
Create time.
Project Changes to this property will trigger replacement. string
ID of the project you want to activate integration on.
RepositoryUrl string
StaticContext bool
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.
Title string
Title.
Token string
A GitHub personal access token with at least repo:status scope.
UpdatedAt string
Update time.
active Boolean
Whether the integration is active.
createdAt String
Create time.
project Changes to this property will trigger replacement. String
ID of the project you want to activate integration on.
repositoryUrl String
staticContext Boolean
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.
title String
Title.
token String
A GitHub personal access token with at least repo:status scope.
updatedAt String
Update time.
active boolean
Whether the integration is active.
createdAt string
Create time.
project Changes to this property will trigger replacement. string
ID of the project you want to activate integration on.
repositoryUrl string
staticContext boolean
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.
title string
Title.
token string
A GitHub personal access token with at least repo:status scope.
updatedAt string
Update time.
active bool
Whether the integration is active.
created_at str
Create time.
project Changes to this property will trigger replacement. str
ID of the project you want to activate integration on.
repository_url str
static_context bool
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.
title str
Title.
token str
A GitHub personal access token with at least repo:status scope.
updated_at str
Update time.
active Boolean
Whether the integration is active.
createdAt String
Create time.
project Changes to this property will trigger replacement. String
ID of the project you want to activate integration on.
repositoryUrl String
staticContext Boolean
Append instance name instead of branch to the status. Must enable to set a GitLab status check as required in GitHub. See [Static / dynamic status check names] to learn more.
title String
Title.
token String
A GitHub personal access token with at least repo:status scope.
updatedAt String
Update time.

Import

Starting in Terraform v1.5.0 you can use an import block to import gitlab_integration_github. For example:

terraform

import {

to = gitlab_integration_github.example

id = “see CLI command below for ID”

}

Import using the CLI is supported using the following syntax:

$ pulumi import gitlab:index/integrationGithub:IntegrationGithub You can import a gitlab_integration_github state using `<resource> <project_id>`:
Copy
$ pulumi import gitlab:index/integrationGithub:IntegrationGithub github 1
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
GitLab pulumi/pulumi-gitlab
License
Apache-2.0
Notes
This Pulumi package is based on the gitlab Terraform Provider.