Webhook 🆕
Webhooks in StackGuardian, offer a dynamic way to integrate external services with your cloud infrastructure workflows. These hooks trigger HTTP POST requests in response to specified events in your workflows or stacks, enabling real-time automation and communication with other systems.
Step-by-Step Guide to Create a Webhook​
In this guide, we configure a webhook to alert the team upon the success, failure, or on Drift Detection of a Terraform workflow. This workflow is responsible for deploying and managing an AWS website using the 'aws-s3-demo-website' Infrastructure as Code template.
To begin, click "Create Workflow" and select the terraform type with Use Wizard (Preview):

1. Source and Parameters​
- Choose "Subscribed Templates" for ready-to-use blueprint templates from your library.
- Under Source Type, choose Subscribed Template and search for
aws-s3-demo-website - In "Template Parameters" pick the latest revision, click Next.

2. Runtime Environment​
- In "Deployment Environment", select a connector that matches your platform or environment, set environment variables if needed, and click Next.
- Specify the "Runner type" under "Execution Environment" for execution flexibility and organizational visibility.
- Opt-in for
Automated Drift Check,Terraform Plan Approval, andSG Managed Backendto streamline workflow execution, state and lifecycle management for the workflows. - Under Advanced Options > Resources and Events > Webhook, set up the webhooks:
-
For Errors: Captures and notifies when workflow errors occur.
- Webhook Name:
Error Webhook. - Webhook URL: Enter the Generic JSON webhook URL.
- Webhook Secret: Enter the secret (optional).
- Webhook Name:
-
For Success: Sends notifications upon successful completion of the workflow.
- Webhook Name:
Success Webhook. - Use the same Generic JSON webhook URL and secret as for errors.
- Webhook Name:
-
On Drift Detection: Alerts when configuration drift is detected in the infrastructure.
- Webhook Name:
Drift Detection Webhook. - Use the same Generic JSON webhook URL and secret as for other events.
- Webhook Name:
-
Click
Addfor each event to finalize and click Next.

3. Workflow Metadata​
- Workflow Name: Suggest a name, like
wehook-workflow. - Description and Tags: Provide an optional description and tags, click "Next" to proceed.

4. Review and Launch​
- Review the settings and click Launch to create your workflow.

Fig: Setting up a 'Static S3 website' Terraform workflow with webhook
With these steps, StackGuardian will emit a JSON payload the workflow's outcome, which can integrated with other different services.