1. Packages
  2. Bitbucket Provider
  3. API Docs
  4. Hook
bitbucket 2.46.0 published on Monday, Apr 14, 2025 by drfaust92

bitbucket.Hook

Explore with Pulumi AI

bitbucket logo
bitbucket 2.46.0 published on Monday, Apr 14, 2025 by drfaust92

    Provides a Bitbucket hook resource.

    This allows you to manage your webhooks on a repository.

    OAuth2 Scopes: webhook

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as bitbucket from "@pulumi/bitbucket";
    
    const deployOnPush = new bitbucket.Hook("deployOnPush", {
        description: "Deploy the code via my webhook",
        events: ["repo:push"],
        owner: "myteam",
        repository: "terraform-code",
        url: "https://mywebhookservice.mycompany.com/deploy-on-push",
    });
    
    import pulumi
    import pulumi_bitbucket as bitbucket
    
    deploy_on_push = bitbucket.Hook("deployOnPush",
        description="Deploy the code via my webhook",
        events=["repo:push"],
        owner="myteam",
        repository="terraform-code",
        url="https://mywebhookservice.mycompany.com/deploy-on-push")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/bitbucket/v2/bitbucket"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := bitbucket.NewHook(ctx, "deployOnPush", &bitbucket.HookArgs{
    			Description: pulumi.String("Deploy the code via my webhook"),
    			Events: pulumi.StringArray{
    				pulumi.String("repo:push"),
    			},
    			Owner:      pulumi.String("myteam"),
    			Repository: pulumi.String("terraform-code"),
    			Url:        pulumi.String("https://mywebhookservice.mycompany.com/deploy-on-push"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Bitbucket = Pulumi.Bitbucket;
    
    return await Deployment.RunAsync(() => 
    {
        var deployOnPush = new Bitbucket.Hook("deployOnPush", new()
        {
            Description = "Deploy the code via my webhook",
            Events = new[]
            {
                "repo:push",
            },
            Owner = "myteam",
            Repository = "terraform-code",
            Url = "https://mywebhookservice.mycompany.com/deploy-on-push",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.bitbucket.Hook;
    import com.pulumi.bitbucket.HookArgs;
    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 deployOnPush = new Hook("deployOnPush", HookArgs.builder()
                .description("Deploy the code via my webhook")
                .events("repo:push")
                .owner("myteam")
                .repository("terraform-code")
                .url("https://mywebhookservice.mycompany.com/deploy-on-push")
                .build());
    
        }
    }
    
    resources:
      deployOnPush:
        type: bitbucket:Hook
        properties:
          description: Deploy the code via my webhook
          events:
            - repo:push
          owner: myteam
          repository: terraform-code
          url: https://mywebhookservice.mycompany.com/deploy-on-push
    

    Create Hook Resource

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

    Constructor syntax

    new Hook(name: string, args: HookArgs, opts?: CustomResourceOptions);
    @overload
    def Hook(resource_name: str,
             args: HookArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Hook(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             description: Optional[str] = None,
             events: Optional[Sequence[str]] = None,
             owner: Optional[str] = None,
             repository: Optional[str] = None,
             url: Optional[str] = None,
             active: Optional[bool] = None,
             history_enabled: Optional[bool] = None,
             hook_id: Optional[str] = None,
             secret: Optional[str] = None,
             skip_cert_verification: Optional[bool] = None)
    func NewHook(ctx *Context, name string, args HookArgs, opts ...ResourceOption) (*Hook, error)
    public Hook(string name, HookArgs args, CustomResourceOptions? opts = null)
    public Hook(String name, HookArgs args)
    public Hook(String name, HookArgs args, CustomResourceOptions options)
    
    type: bitbucket:Hook
    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 HookArgs
    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 HookArgs
    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 HookArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args HookArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args HookArgs
    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 hookResource = new Bitbucket.Hook("hookResource", new()
    {
        Description = "string",
        Events = new[]
        {
            "string",
        },
        Owner = "string",
        Repository = "string",
        Url = "string",
        Active = false,
        HistoryEnabled = false,
        HookId = "string",
        Secret = "string",
        SkipCertVerification = false,
    });
    
    example, err := bitbucket.NewHook(ctx, "hookResource", &bitbucket.HookArgs{
    	Description: pulumi.String("string"),
    	Events: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Owner:                pulumi.String("string"),
    	Repository:           pulumi.String("string"),
    	Url:                  pulumi.String("string"),
    	Active:               pulumi.Bool(false),
    	HistoryEnabled:       pulumi.Bool(false),
    	HookId:               pulumi.String("string"),
    	Secret:               pulumi.String("string"),
    	SkipCertVerification: pulumi.Bool(false),
    })
    
    var hookResource = new Hook("hookResource", HookArgs.builder()
        .description("string")
        .events("string")
        .owner("string")
        .repository("string")
        .url("string")
        .active(false)
        .historyEnabled(false)
        .hookId("string")
        .secret("string")
        .skipCertVerification(false)
        .build());
    
    hook_resource = bitbucket.Hook("hookResource",
        description="string",
        events=["string"],
        owner="string",
        repository="string",
        url="string",
        active=False,
        history_enabled=False,
        hook_id="string",
        secret="string",
        skip_cert_verification=False)
    
    const hookResource = new bitbucket.Hook("hookResource", {
        description: "string",
        events: ["string"],
        owner: "string",
        repository: "string",
        url: "string",
        active: false,
        historyEnabled: false,
        hookId: "string",
        secret: "string",
        skipCertVerification: false,
    });
    
    type: bitbucket:Hook
    properties:
        active: false
        description: string
        events:
            - string
        historyEnabled: false
        hookId: string
        owner: string
        repository: string
        secret: string
        skipCertVerification: false
        url: string
    

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

    Description string
    The name / description to show in the UI.
    Events List<string>
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    Owner string
    The owner of this repository. Can be you or any team you have write access to.
    Repository string
    The name of the repository.
    Url string
    Where to POST to.
    Active bool
    Whether the webhook configuration is active or not (Default: true).
    HistoryEnabled bool
    Whether a webhook history is enabled.
    HookId string
    Secret string
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    SkipCertVerification bool
    Whether to skip certificate verification or not (Default: true).
    Description string
    The name / description to show in the UI.
    Events []string
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    Owner string
    The owner of this repository. Can be you or any team you have write access to.
    Repository string
    The name of the repository.
    Url string
    Where to POST to.
    Active bool
    Whether the webhook configuration is active or not (Default: true).
    HistoryEnabled bool
    Whether a webhook history is enabled.
    HookId string
    Secret string
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    SkipCertVerification bool
    Whether to skip certificate verification or not (Default: true).
    description String
    The name / description to show in the UI.
    events List<String>
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    owner String
    The owner of this repository. Can be you or any team you have write access to.
    repository String
    The name of the repository.
    url String
    Where to POST to.
    active Boolean
    Whether the webhook configuration is active or not (Default: true).
    historyEnabled Boolean
    Whether a webhook history is enabled.
    hookId String
    secret String
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    skipCertVerification Boolean
    Whether to skip certificate verification or not (Default: true).
    description string
    The name / description to show in the UI.
    events string[]
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    owner string
    The owner of this repository. Can be you or any team you have write access to.
    repository string
    The name of the repository.
    url string
    Where to POST to.
    active boolean
    Whether the webhook configuration is active or not (Default: true).
    historyEnabled boolean
    Whether a webhook history is enabled.
    hookId string
    secret string
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    skipCertVerification boolean
    Whether to skip certificate verification or not (Default: true).
    description str
    The name / description to show in the UI.
    events Sequence[str]
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    owner str
    The owner of this repository. Can be you or any team you have write access to.
    repository str
    The name of the repository.
    url str
    Where to POST to.
    active bool
    Whether the webhook configuration is active or not (Default: true).
    history_enabled bool
    Whether a webhook history is enabled.
    hook_id str
    secret str
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    skip_cert_verification bool
    Whether to skip certificate verification or not (Default: true).
    description String
    The name / description to show in the UI.
    events List<String>
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    owner String
    The owner of this repository. Can be you or any team you have write access to.
    repository String
    The name of the repository.
    url String
    Where to POST to.
    active Boolean
    Whether the webhook configuration is active or not (Default: true).
    historyEnabled Boolean
    Whether a webhook history is enabled.
    hookId String
    secret String
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    skipCertVerification Boolean
    Whether to skip certificate verification or not (Default: true).

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    SecretSet bool
    Whether a webhook secret is set.
    Uuid string
    The UUID of the workspace webhook.
    Id string
    The provider-assigned unique ID for this managed resource.
    SecretSet bool
    Whether a webhook secret is set.
    Uuid string
    The UUID of the workspace webhook.
    id String
    The provider-assigned unique ID for this managed resource.
    secretSet Boolean
    Whether a webhook secret is set.
    uuid String
    The UUID of the workspace webhook.
    id string
    The provider-assigned unique ID for this managed resource.
    secretSet boolean
    Whether a webhook secret is set.
    uuid string
    The UUID of the workspace webhook.
    id str
    The provider-assigned unique ID for this managed resource.
    secret_set bool
    Whether a webhook secret is set.
    uuid str
    The UUID of the workspace webhook.
    id String
    The provider-assigned unique ID for this managed resource.
    secretSet Boolean
    Whether a webhook secret is set.
    uuid String
    The UUID of the workspace webhook.

    Look up Existing Hook Resource

    Get an existing Hook 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?: HookState, opts?: CustomResourceOptions): Hook
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            active: Optional[bool] = None,
            description: Optional[str] = None,
            events: Optional[Sequence[str]] = None,
            history_enabled: Optional[bool] = None,
            hook_id: Optional[str] = None,
            owner: Optional[str] = None,
            repository: Optional[str] = None,
            secret: Optional[str] = None,
            secret_set: Optional[bool] = None,
            skip_cert_verification: Optional[bool] = None,
            url: Optional[str] = None,
            uuid: Optional[str] = None) -> Hook
    func GetHook(ctx *Context, name string, id IDInput, state *HookState, opts ...ResourceOption) (*Hook, error)
    public static Hook Get(string name, Input<string> id, HookState? state, CustomResourceOptions? opts = null)
    public static Hook get(String name, Output<String> id, HookState state, CustomResourceOptions options)
    resources:  _:    type: bitbucket:Hook    get:      id: ${id}
    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.
    The following state arguments are supported:
    Active bool
    Whether the webhook configuration is active or not (Default: true).
    Description string
    The name / description to show in the UI.
    Events List<string>
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    HistoryEnabled bool
    Whether a webhook history is enabled.
    HookId string
    Owner string
    The owner of this repository. Can be you or any team you have write access to.
    Repository string
    The name of the repository.
    Secret string
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    SecretSet bool
    Whether a webhook secret is set.
    SkipCertVerification bool
    Whether to skip certificate verification or not (Default: true).
    Url string
    Where to POST to.
    Uuid string
    The UUID of the workspace webhook.
    Active bool
    Whether the webhook configuration is active or not (Default: true).
    Description string
    The name / description to show in the UI.
    Events []string
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    HistoryEnabled bool
    Whether a webhook history is enabled.
    HookId string
    Owner string
    The owner of this repository. Can be you or any team you have write access to.
    Repository string
    The name of the repository.
    Secret string
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    SecretSet bool
    Whether a webhook secret is set.
    SkipCertVerification bool
    Whether to skip certificate verification or not (Default: true).
    Url string
    Where to POST to.
    Uuid string
    The UUID of the workspace webhook.
    active Boolean
    Whether the webhook configuration is active or not (Default: true).
    description String
    The name / description to show in the UI.
    events List<String>
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    historyEnabled Boolean
    Whether a webhook history is enabled.
    hookId String
    owner String
    The owner of this repository. Can be you or any team you have write access to.
    repository String
    The name of the repository.
    secret String
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    secretSet Boolean
    Whether a webhook secret is set.
    skipCertVerification Boolean
    Whether to skip certificate verification or not (Default: true).
    url String
    Where to POST to.
    uuid String
    The UUID of the workspace webhook.
    active boolean
    Whether the webhook configuration is active or not (Default: true).
    description string
    The name / description to show in the UI.
    events string[]
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    historyEnabled boolean
    Whether a webhook history is enabled.
    hookId string
    owner string
    The owner of this repository. Can be you or any team you have write access to.
    repository string
    The name of the repository.
    secret string
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    secretSet boolean
    Whether a webhook secret is set.
    skipCertVerification boolean
    Whether to skip certificate verification or not (Default: true).
    url string
    Where to POST to.
    uuid string
    The UUID of the workspace webhook.
    active bool
    Whether the webhook configuration is active or not (Default: true).
    description str
    The name / description to show in the UI.
    events Sequence[str]
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    history_enabled bool
    Whether a webhook history is enabled.
    hook_id str
    owner str
    The owner of this repository. Can be you or any team you have write access to.
    repository str
    The name of the repository.
    secret str
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    secret_set bool
    Whether a webhook secret is set.
    skip_cert_verification bool
    Whether to skip certificate verification or not (Default: true).
    url str
    Where to POST to.
    uuid str
    The UUID of the workspace webhook.
    active Boolean
    Whether the webhook configuration is active or not (Default: true).
    description String
    The name / description to show in the UI.
    events List<String>
    The events this webhook is subscribed to. Valid values can be found at Bitbucket Event Payloads Docs.
    historyEnabled Boolean
    Whether a webhook history is enabled.
    hookId String
    owner String
    The owner of this repository. Can be you or any team you have write access to.
    repository String
    The name of the repository.
    secret String
    A Webhook secret value. Passing a null or empty secret or not passing a secret will leave the webhook's secret unset. This value is not returned on read and cannot resolve diffs or be imported as its not returned back from bitbucket API.
    secretSet Boolean
    Whether a webhook secret is set.
    skipCertVerification Boolean
    Whether to skip certificate verification or not (Default: true).
    url String
    Where to POST to.
    uuid String
    The UUID of the workspace webhook.

    Import

    Hooks can be imported using their owner/repo-name/hook-id ID, e.g.

    $ pulumi import bitbucket:index/hook:Hook hook my-account/my-repo/hook-id
    

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

    Package Details

    Repository
    bitbucket drfaust92/terraform-provider-bitbucket
    License
    Notes
    This Pulumi package is based on the bitbucket Terraform Provider.
    bitbucket logo
    bitbucket 2.46.0 published on Monday, Apr 14, 2025 by drfaust92