ProjectHook

class ProjectHook : KotlinCustomResource

The gitlab.ProjectHook resource allows to manage the lifecycle of a project hook. Upstream API: GitLab REST API docs

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const example = new gitlab.ProjectHook("example", {
project: "example/hooked",
url: "https://example.com/hook/example",
name: "example",
description: "Example hook",
mergeRequestsEvents: true,
});
// Using Custom Headers
// Values of headers can't be imported
const customHeaders = new gitlab.ProjectHook("custom_headers", {
project: "example/hooked",
url: "https://example.com/hook/example",
mergeRequestsEvents: true,
customHeaders: [
{
key: "X-Custom-Header",
value: "example",
},
{
key: "X-Custom-Header-Second",
value: "example-second",
},
],
});
import pulumi
import pulumi_gitlab as gitlab
example = gitlab.ProjectHook("example",
project="example/hooked",
url="https://example.com/hook/example",
name="example",
description="Example hook",
merge_requests_events=True)
# Using Custom Headers
# Values of headers can't be imported
custom_headers = gitlab.ProjectHook("custom_headers",
project="example/hooked",
url="https://example.com/hook/example",
merge_requests_events=True,
custom_headers=[
{
"key": "X-Custom-Header",
"value": "example",
},
{
"key": "X-Custom-Header-Second",
"value": "example-second",
},
])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
var example = new GitLab.ProjectHook("example", new()
{
Project = "example/hooked",
Url = "https://example.com/hook/example",
Name = "example",
Description = "Example hook",
MergeRequestsEvents = true,
});
// Using Custom Headers
// Values of headers can't be imported
var customHeaders = new GitLab.ProjectHook("custom_headers", new()
{
Project = "example/hooked",
Url = "https://example.com/hook/example",
MergeRequestsEvents = true,
CustomHeaders = new[]
{
new GitLab.Inputs.ProjectHookCustomHeaderArgs
{
Key = "X-Custom-Header",
Value = "example",
},
new GitLab.Inputs.ProjectHookCustomHeaderArgs
{
Key = "X-Custom-Header-Second",
Value = "example-second",
},
},
});
});
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 {
_, err := gitlab.NewProjectHook(ctx, "example", &gitlab.ProjectHookArgs{
Project: pulumi.String("example/hooked"),
Url: pulumi.String("https://example.com/hook/example"),
Name: pulumi.String("example"),
Description: pulumi.String("Example hook"),
MergeRequestsEvents: pulumi.Bool(true),
})
if err != nil {
return err
}
// Using Custom Headers
// Values of headers can't be imported
_, err = gitlab.NewProjectHook(ctx, "custom_headers", &gitlab.ProjectHookArgs{
Project: pulumi.String("example/hooked"),
Url: pulumi.String("https://example.com/hook/example"),
MergeRequestsEvents: pulumi.Bool(true),
CustomHeaders: gitlab.ProjectHookCustomHeaderArray{
&gitlab.ProjectHookCustomHeaderArgs{
Key: pulumi.String("X-Custom-Header"),
Value: pulumi.String("example"),
},
&gitlab.ProjectHookCustomHeaderArgs{
Key: pulumi.String("X-Custom-Header-Second"),
Value: pulumi.String("example-second"),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.ProjectHook;
import com.pulumi.gitlab.ProjectHookArgs;
import com.pulumi.gitlab.inputs.ProjectHookCustomHeaderArgs;
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 example = new ProjectHook("example", ProjectHookArgs.builder()
.project("example/hooked")
.url("https://example.com/hook/example")
.name("example")
.description("Example hook")
.mergeRequestsEvents(true)
.build());
// Using Custom Headers
// Values of headers can't be imported
var customHeaders = new ProjectHook("customHeaders", ProjectHookArgs.builder()
.project("example/hooked")
.url("https://example.com/hook/example")
.mergeRequestsEvents(true)
.customHeaders(
ProjectHookCustomHeaderArgs.builder()
.key("X-Custom-Header")
.value("example")
.build(),
ProjectHookCustomHeaderArgs.builder()
.key("X-Custom-Header-Second")
.value("example-second")
.build())
.build());
}
}
resources:
example:
type: gitlab:ProjectHook
properties:
project: example/hooked
url: https://example.com/hook/example
name: example
description: Example hook
mergeRequestsEvents: true
# Using Custom Headers
# Values of headers can't be imported
customHeaders:
type: gitlab:ProjectHook
name: custom_headers
properties:
project: example/hooked
url: https://example.com/hook/example
mergeRequestsEvents: true
customHeaders:
- key: X-Custom-Header
value: example
- key: X-Custom-Header-Second
value: example-second

Import

Starting in Terraform v1.5.0 you can use an import block to import gitlab_project_hook. For example: terraform import { to = gitlab_project_hook.example id = "see CLI command below for ID" } Import using the CLI is supported using the following syntax: A GitLab Project Hook can be imported using a key composed of <project-id>:<hook-id>, e.g.

$ pulumi import gitlab:index/projectHook:ProjectHook example "12345:1"

NOTE: the token resource attribute is not available for imported resources as this information cannot be read from the GitLab API.

Properties

Link copied to clipboard

Invoke the hook for confidential issues events.

Link copied to clipboard

Invoke the hook for confidential note events.

Link copied to clipboard

Custom headers for the project webhook.

Link copied to clipboard

Custom webhook template.

Link copied to clipboard

Invoke the hook for deployment events.

Link copied to clipboard
val description: Output<String>

Description of the webhook.

Link copied to clipboard

Enable SSL verification when invoking the hook.

Link copied to clipboard
val hookId: Output<Int>

The id of the project hook.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val issuesEvents: Output<Boolean>

Invoke the hook for issues events.

Link copied to clipboard
val jobEvents: Output<Boolean>

Invoke the hook for job events.

Link copied to clipboard

Invoke the hook for merge requests events.

Link copied to clipboard
val name: Output<String>

Name of the project webhook.

Link copied to clipboard
val noteEvents: Output<Boolean>

Invoke the hook for note events.

Link copied to clipboard
val pipelineEvents: Output<Boolean>

Invoke the hook for pipeline events.

Link copied to clipboard
val project: Output<String>

The name or id of the project to add the hook to.

Link copied to clipboard
val projectId: Output<Int>

The id of the project for the hook.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val pushEvents: Output<Boolean>

Invoke the hook for push events.

Link copied to clipboard

Invoke the hook for push events on matching branches only.

Link copied to clipboard
val releasesEvents: Output<Boolean>

Invoke the hook for release events.

Link copied to clipboard

Invoke the hook for project access token expiry events.

Link copied to clipboard
val tagPushEvents: Output<Boolean>

Invoke the hook for tag push events.

Link copied to clipboard
val token: Output<String>

A token to present when invoking the hook. The token is not available for imported resources.

Link copied to clipboard
val url: Output<String>

The url of the hook to invoke. Forces re-creation to preserve token.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val wikiPageEvents: Output<Boolean>

Invoke the hook for wiki page events.