An example webhook handler for Common Fate, deployed using the AWS CDK. It uses a preshared authorization header for authentication.
-
Replace the authorization header and the permission set identifier in
cmd/lambda/main.go
. -
Deploy the Lambda function:
npm run cdk deploy
. -
Add a webhook handler to your Common Fate configuration, replacing the
url
andheaders
values with ones matching the Lambda function you have deployed:
resource "commonfate_webhook_integration" "example_lambda" {
name = "Example Lambda"
url = "https://abcdef.lambda-url.ap-southeast-2.on.aws" // REPLACE THIS
headers = [
{
key = "Authorization",
value = "abcdef" // REPLACE THIS
},
]
send_audit_log_events = true
}
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testsnpx cdk deploy
deploy this stack to your default AWS account/regionnpx cdk diff
compare deployed stack with current statenpx cdk synth
emits the synthesized CloudFormation template