AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::CodePipeline::Webhook

CfnWebhook

The `AWS::CodePipeline::Webhook` resource creates and registers your webhook. After the webhook is created and registered, it triggers your pipeline to start every time an external event occurs. For more information, see [Migrate polling pipelines to use event-based change detection](https://docs.aws.amazon.com/codepipeline/latest/userguide/update-change-detection.html) in the *AWS CodePipeline User Guide* . We strongly recommend that you use AWS Secrets Manager to store your credentials. If you use Secrets Manager, you must have already configured and stored your secret parameters in Secrets Manager. For more information, see [Using Dynamic References to Specify Template Values](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html#dynamic-references-secretsmanager) . > When passing secret parameters, do not enter the value directly into the template. The value is rendered as plaintext and is therefore readable. For security reasons, do not use plaintext in your AWS CloudFormation template to store your credentials.

Import

import { CfnWebhook } from 'aws-cdk-lib/aws-codepipeline';

Or use the module namespace:

import * as codepipeline from 'aws-cdk-lib/aws-codepipeline';
// codepipeline.CfnWebhook

Properties

Configuration passed to the constructor as CfnWebhookProps.

authenticationRequired
string

Supported options are GITHUB_HMAC, IP, and UNAUTHENTICATED. > When creating CodePipeline webhooks, do not use your own credentials or reuse the same secret token across multiple webhooks. For optimal security, generate a unique secret token for each webhook you create. The secret token is an arbitrary string that you provide, which GitHub uses to compute and sign the webhook payloads sent to CodePipeline, for protecting the integrity and authenticity of the webhook payloads. Using your own credentials or reusing the same token across multiple webhooks can lead to security vulnerabilities. > If a secret token was provided, it will be redacted in the response. - For information about the authentication scheme implemented by GITHUB_HMAC, see [Securing your webhooks](https://docs.aws.amazon.com/https://developer.github.com/webhooks/securing/) on the GitHub Developer website. - IP rejects webhooks trigger requests unless they originate from an IP address in the IP range whitelisted in the authentication configuration. - UNAUTHENTICATED accepts all webhook trigger requests regardless of origin.

authenticationConfigurationRequired
IResolvable | WebhookAuthConfigurationProperty

Properties that configure the authentication applied to incoming webhook trigger requests. The required properties depend on the authentication type. For GITHUB_HMAC, only the `SecretToken` property must be set. For IP, only the `AllowedIPRange` property must be set to a valid CIDR range. For UNAUTHENTICATED, no properties can be set.

filtersRequired
IResolvable | IResolvable | WebhookFilterRuleProperty[]

A list of rules applied to the body/payload sent in the POST request to a webhook URL. All defined rules must pass for the request to be accepted and the pipeline started.

targetActionRequired
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.

targetPipelineRequired
string

The name of the pipeline you want to connect to the webhook.

nameOptional
string

The name of the webhook.

registerWithThirdPartyOptional
boolean | IResolvable

Configures a connection between the webhook that was created and the external tool with events to be detected.

targetPipelineVersionOptional
number

The version number of the pipeline to be connected to the trigger request. Required: Yes Type: Integer Update requires: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter