Webhook

class Webhook : KotlinCustomResource

Provides a CodePipeline Webhook.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.codepipeline.Pipeline;
import com.pulumi.aws.codepipeline.PipelineArgs;
import com.pulumi.aws.codepipeline.inputs.PipelineArtifactStoreArgs;
import com.pulumi.aws.codepipeline.inputs.PipelineArtifactStoreEncryptionKeyArgs;
import com.pulumi.aws.codepipeline.inputs.PipelineStageArgs;
import com.pulumi.aws.codepipeline.Webhook;
import com.pulumi.aws.codepipeline.WebhookArgs;
import com.pulumi.aws.codepipeline.inputs.WebhookAuthenticationConfigurationArgs;
import com.pulumi.aws.codepipeline.inputs.WebhookFilterArgs;
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 barPipeline = new Pipeline("barPipeline", PipelineArgs.builder()
.roleArn(aws_iam_role.bar().arn())
.artifactStores(PipelineArtifactStoreArgs.builder()
.location(aws_s3_bucket.bar().bucket())
.type("S3")
.encryptionKey(PipelineArtifactStoreEncryptionKeyArgs.builder()
.id(data.aws_kms_alias().s3kmskey().arn())
.type("KMS")
.build())
.build())
.stages(
PipelineStageArgs.builder()
.name("Source")
.actions(PipelineStageActionArgs.builder()
.name("Source")
.category("Source")
.owner("ThirdParty")
.provider("GitHub")
.version("1")
.outputArtifacts("test")
.configuration(Map.ofEntries(
Map.entry("Owner", "my-organization"),
Map.entry("Repo", "test"),
Map.entry("Branch", "master")
))
.build())
.build(),
PipelineStageArgs.builder()
.name("Build")
.actions(PipelineStageActionArgs.builder()
.name("Build")
.category("Build")
.owner("AWS")
.provider("CodeBuild")
.inputArtifacts("test")
.version("1")
.configuration(Map.of("ProjectName", "test"))
.build())
.build())
.build());
final var webhookSecret = "super-secret";
var barWebhook = new Webhook("barWebhook", WebhookArgs.builder()
.authentication("GITHUB_HMAC")
.targetAction("Source")
.targetPipeline(barPipeline.name())
.authenticationConfiguration(WebhookAuthenticationConfigurationArgs.builder()
.secretToken(webhookSecret)
.build())
.filters(WebhookFilterArgs.builder()
.jsonPath("$.ref")
.matchEquals("refs/heads/{Branch}")
.build())
.build());
var barRepositoryWebhook = new RepositoryWebhook("barRepositoryWebhook", RepositoryWebhookArgs.builder()
.repository(github_repository.repo().name())
.configuration(RepositoryWebhookConfigurationArgs.builder()
.url(barWebhook.url())
.contentType("json")
.insecureSsl(true)
.secret(webhookSecret)
.build())
.events("push")
.build());
}
}

Import

CodePipeline Webhooks can be imported by their ARN, e.g.,

$ pulumi import aws:codepipeline/webhook:Webhook example arn:aws:codepipeline:us-west-2:123456789012:webhook:example

Properties

Link copied to clipboard
val arn: Output<String>

The CodePipeline webhook's ARN.

Link copied to clipboard
val authentication: Output<String>

The type of authentication to use. One of IP, GITHUB_HMAC, or UNAUTHENTICATED.

Link copied to clipboard

An auth block. Required for IP and GITHUB_HMAC. Auth blocks are documented below.

Link copied to clipboard
val filters: Output<List<WebhookFilter>>

One or more filter blocks. Filter blocks are documented below.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

The name of the webhook.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val tags: Output<Map<String, String>>?

A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val targetAction: Output<String>

The name of the action in a pipeline you want to connect to the webhook. The action must be from the source (first) stage of the pipeline.

Link copied to clipboard
val targetPipeline: Output<String>

The name of the pipeline.

Link copied to clipboard
val url: Output<String>

The CodePipeline webhook's URL. POST events to this endpoint to trigger the target.

Link copied to clipboard
val urn: Output<String>