github.RepositoryWebhook
Explore with Pulumi AI
This resource allows you to create and manage webhooks for repositories within your GitHub organization or personal account.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const repo = new github.Repository("repo", {
name: "foo",
description: "Terraform acceptance tests",
homepageUrl: "http://example.com/",
visibility: "public",
});
const foo = new github.RepositoryWebhook("foo", {
repository: repo.name,
configuration: {
url: "https://google.de/",
contentType: "form",
insecureSsl: false,
},
active: false,
events: ["issues"],
});
import pulumi
import pulumi_github as github
repo = github.Repository("repo",
name="foo",
description="Terraform acceptance tests",
homepage_url="http://example.com/",
visibility="public")
foo = github.RepositoryWebhook("foo",
repository=repo.name,
configuration={
"url": "https://google.de/",
"content_type": "form",
"insecure_ssl": False,
},
active=False,
events=["issues"])
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
repo, err := github.NewRepository(ctx, "repo", &github.RepositoryArgs{
Name: pulumi.String("foo"),
Description: pulumi.String("Terraform acceptance tests"),
HomepageUrl: pulumi.String("http://example.com/"),
Visibility: pulumi.String("public"),
})
if err != nil {
return err
}
_, err = github.NewRepositoryWebhook(ctx, "foo", &github.RepositoryWebhookArgs{
Repository: repo.Name,
Configuration: &github.RepositoryWebhookConfigurationArgs{
Url: pulumi.String("https://google.de/"),
ContentType: pulumi.String("form"),
InsecureSsl: pulumi.Bool(false),
},
Active: pulumi.Bool(false),
Events: pulumi.StringArray{
pulumi.String("issues"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var repo = new Github.Repository("repo", new()
{
Name = "foo",
Description = "Terraform acceptance tests",
HomepageUrl = "http://example.com/",
Visibility = "public",
});
var foo = new Github.RepositoryWebhook("foo", new()
{
Repository = repo.Name,
Configuration = new Github.Inputs.RepositoryWebhookConfigurationArgs
{
Url = "https://google.de/",
ContentType = "form",
InsecureSsl = false,
},
Active = false,
Events = new[]
{
"issues",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.Repository;
import com.pulumi.github.RepositoryArgs;
import com.pulumi.github.RepositoryWebhook;
import com.pulumi.github.RepositoryWebhookArgs;
import com.pulumi.github.inputs.RepositoryWebhookConfigurationArgs;
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 repo = new Repository("repo", RepositoryArgs.builder()
.name("foo")
.description("Terraform acceptance tests")
.homepageUrl("http://example.com/")
.visibility("public")
.build());
var foo = new RepositoryWebhook("foo", RepositoryWebhookArgs.builder()
.repository(repo.name())
.configuration(RepositoryWebhookConfigurationArgs.builder()
.url("https://google.de/")
.contentType("form")
.insecureSsl(false)
.build())
.active(false)
.events("issues")
.build());
}
}
resources:
repo:
type: github:Repository
properties:
name: foo
description: Terraform acceptance tests
homepageUrl: http://example.com/
visibility: public
foo:
type: github:RepositoryWebhook
properties:
repository: ${repo.name}
configuration:
url: https://google.de/
contentType: form
insecureSsl: false
active: false
events:
- issues
Create RepositoryWebhook Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RepositoryWebhook(name: string, args: RepositoryWebhookArgs, opts?: CustomResourceOptions);
@overload
def RepositoryWebhook(resource_name: str,
args: RepositoryWebhookArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RepositoryWebhook(resource_name: str,
opts: Optional[ResourceOptions] = None,
events: Optional[Sequence[str]] = None,
repository: Optional[str] = None,
active: Optional[bool] = None,
configuration: Optional[RepositoryWebhookConfigurationArgs] = None)
func NewRepositoryWebhook(ctx *Context, name string, args RepositoryWebhookArgs, opts ...ResourceOption) (*RepositoryWebhook, error)
public RepositoryWebhook(string name, RepositoryWebhookArgs args, CustomResourceOptions? opts = null)
public RepositoryWebhook(String name, RepositoryWebhookArgs args)
public RepositoryWebhook(String name, RepositoryWebhookArgs args, CustomResourceOptions options)
type: github:RepositoryWebhook
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RepositoryWebhookArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RepositoryWebhookArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RepositoryWebhookArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RepositoryWebhookArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RepositoryWebhookArgs
- 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 repositoryWebhookResource = new Github.RepositoryWebhook("repositoryWebhookResource", new()
{
Events = new[]
{
"string",
},
Repository = "string",
Active = false,
Configuration = new Github.Inputs.RepositoryWebhookConfigurationArgs
{
Url = "string",
ContentType = "string",
InsecureSsl = false,
Secret = "string",
},
});
example, err := github.NewRepositoryWebhook(ctx, "repositoryWebhookResource", &github.RepositoryWebhookArgs{
Events: pulumi.StringArray{
pulumi.String("string"),
},
Repository: pulumi.String("string"),
Active: pulumi.Bool(false),
Configuration: &github.RepositoryWebhookConfigurationArgs{
Url: pulumi.String("string"),
ContentType: pulumi.String("string"),
InsecureSsl: pulumi.Bool(false),
Secret: pulumi.String("string"),
},
})
var repositoryWebhookResource = new RepositoryWebhook("repositoryWebhookResource", RepositoryWebhookArgs.builder()
.events("string")
.repository("string")
.active(false)
.configuration(RepositoryWebhookConfigurationArgs.builder()
.url("string")
.contentType("string")
.insecureSsl(false)
.secret("string")
.build())
.build());
repository_webhook_resource = github.RepositoryWebhook("repositoryWebhookResource",
events=["string"],
repository="string",
active=False,
configuration={
"url": "string",
"content_type": "string",
"insecure_ssl": False,
"secret": "string",
})
const repositoryWebhookResource = new github.RepositoryWebhook("repositoryWebhookResource", {
events: ["string"],
repository: "string",
active: false,
configuration: {
url: "string",
contentType: "string",
insecureSsl: false,
secret: "string",
},
});
type: github:RepositoryWebhook
properties:
active: false
configuration:
contentType: string
insecureSsl: false
secret: string
url: string
events:
- string
repository: string
RepositoryWebhook 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 RepositoryWebhook resource accepts the following input properties:
- Events List<string>
- A list of events which should trigger the webhook. See a list of available events.
- Repository string
- The repository of the webhook.
- Active bool
- Indicate if the webhook should receive events. Defaults to
true
. - Configuration
Repository
Webhook Configuration - Configuration block for the webhook. Detailed below.
- Events []string
- A list of events which should trigger the webhook. See a list of available events.
- Repository string
- The repository of the webhook.
- Active bool
- Indicate if the webhook should receive events. Defaults to
true
. - Configuration
Repository
Webhook Configuration Args - Configuration block for the webhook. Detailed below.
- events List<String>
- A list of events which should trigger the webhook. See a list of available events.
- repository String
- The repository of the webhook.
- active Boolean
- Indicate if the webhook should receive events. Defaults to
true
. - configuration
Repository
Webhook Configuration - Configuration block for the webhook. Detailed below.
- events string[]
- A list of events which should trigger the webhook. See a list of available events.
- repository string
- The repository of the webhook.
- active boolean
- Indicate if the webhook should receive events. Defaults to
true
. - configuration
Repository
Webhook Configuration - Configuration block for the webhook. Detailed below.
- events Sequence[str]
- A list of events which should trigger the webhook. See a list of available events.
- repository str
- The repository of the webhook.
- active bool
- Indicate if the webhook should receive events. Defaults to
true
. - configuration
Repository
Webhook Configuration Args - Configuration block for the webhook. Detailed below.
- events List<String>
- A list of events which should trigger the webhook. See a list of available events.
- repository String
- The repository of the webhook.
- active Boolean
- Indicate if the webhook should receive events. Defaults to
true
. - configuration Property Map
- Configuration block for the webhook. Detailed below.
Outputs
All input properties are implicitly available as output properties. Additionally, the RepositoryWebhook resource produces the following output properties:
Look up Existing RepositoryWebhook Resource
Get an existing RepositoryWebhook 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?: RepositoryWebhookState, opts?: CustomResourceOptions): RepositoryWebhook
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
active: Optional[bool] = None,
configuration: Optional[RepositoryWebhookConfigurationArgs] = None,
etag: Optional[str] = None,
events: Optional[Sequence[str]] = None,
repository: Optional[str] = None,
url: Optional[str] = None) -> RepositoryWebhook
func GetRepositoryWebhook(ctx *Context, name string, id IDInput, state *RepositoryWebhookState, opts ...ResourceOption) (*RepositoryWebhook, error)
public static RepositoryWebhook Get(string name, Input<string> id, RepositoryWebhookState? state, CustomResourceOptions? opts = null)
public static RepositoryWebhook get(String name, Output<String> id, RepositoryWebhookState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Active bool
- Indicate if the webhook should receive events. Defaults to
true
. - Configuration
Repository
Webhook Configuration - Configuration block for the webhook. Detailed below.
- Etag string
- Events List<string>
- A list of events which should trigger the webhook. See a list of available events.
- Repository string
- The repository of the webhook.
- Url string
- URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
- Active bool
- Indicate if the webhook should receive events. Defaults to
true
. - Configuration
Repository
Webhook Configuration Args - Configuration block for the webhook. Detailed below.
- Etag string
- Events []string
- A list of events which should trigger the webhook. See a list of available events.
- Repository string
- The repository of the webhook.
- Url string
- URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
- active Boolean
- Indicate if the webhook should receive events. Defaults to
true
. - configuration
Repository
Webhook Configuration - Configuration block for the webhook. Detailed below.
- etag String
- events List<String>
- A list of events which should trigger the webhook. See a list of available events.
- repository String
- The repository of the webhook.
- url String
- URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
- active boolean
- Indicate if the webhook should receive events. Defaults to
true
. - configuration
Repository
Webhook Configuration - Configuration block for the webhook. Detailed below.
- etag string
- events string[]
- A list of events which should trigger the webhook. See a list of available events.
- repository string
- The repository of the webhook.
- url string
- URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
- active bool
- Indicate if the webhook should receive events. Defaults to
true
. - configuration
Repository
Webhook Configuration Args - Configuration block for the webhook. Detailed below.
- etag str
- events Sequence[str]
- A list of events which should trigger the webhook. See a list of available events.
- repository str
- The repository of the webhook.
- url str
- URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
- active Boolean
- Indicate if the webhook should receive events. Defaults to
true
. - configuration Property Map
- Configuration block for the webhook. Detailed below.
- etag String
- events List<String>
- A list of events which should trigger the webhook. See a list of available events.
- repository String
- The repository of the webhook.
- url String
- URL of the webhook. This is a sensitive attribute because it may include basic auth credentials.
Supporting Types
RepositoryWebhookConfiguration, RepositoryWebhookConfigurationArgs
- Url string
- The URL of the webhook.
- Content
Type string - The content type for the payload. Valid values are either
form
orjson
. - Insecure
Ssl bool - Insecure SSL boolean toggle. Defaults to
false
. - Secret string
- The shared secret for the webhook. See API documentation.
- Url string
- The URL of the webhook.
- Content
Type string - The content type for the payload. Valid values are either
form
orjson
. - Insecure
Ssl bool - Insecure SSL boolean toggle. Defaults to
false
. - Secret string
- The shared secret for the webhook. See API documentation.
- url String
- The URL of the webhook.
- content
Type String - The content type for the payload. Valid values are either
form
orjson
. - insecure
Ssl Boolean - Insecure SSL boolean toggle. Defaults to
false
. - secret String
- The shared secret for the webhook. See API documentation.
- url string
- The URL of the webhook.
- content
Type string - The content type for the payload. Valid values are either
form
orjson
. - insecure
Ssl boolean - Insecure SSL boolean toggle. Defaults to
false
. - secret string
- The shared secret for the webhook. See API documentation.
- url str
- The URL of the webhook.
- content_
type str - The content type for the payload. Valid values are either
form
orjson
. - insecure_
ssl bool - Insecure SSL boolean toggle. Defaults to
false
. - secret str
- The shared secret for the webhook. See API documentation.
- url String
- The URL of the webhook.
- content
Type String - The content type for the payload. Valid values are either
form
orjson
. - insecure
Ssl Boolean - Insecure SSL boolean toggle. Defaults to
false
. - secret String
- The shared secret for the webhook. See API documentation.
Import
Repository webhooks can be imported using the name
of the repository, combined with the id
of the webhook, separated by a /
character.
The id
of the webhook can be found in the URL of the webhook. For example: "https://github.com/foo-org/foo-repo/settings/hooks/14711452"
.
Importing uses the name of the repository, as well as the ID of the webhook, e.g.
$ pulumi import github:index/repositoryWebhook:RepositoryWebhook terraform terraform/11235813
If secret is populated in the webhook’s configuration, the value will be imported as “********”.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- GitHub pulumi/pulumi-github
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
github
Terraform Provider.