> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blinkops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using a Terraform Cloud Run Task Webhook trigger in Blink

> You can trigger Blink with events from Terraform using Terraform Run Tasks.

<Note>
  You cannot create a Run Task unless the Automation is published and active, and has at least one step.
</Note>

## Creating a Terraform Cloud Run Task Webhook trigger in Blink[​](#creating-a-terraform-cloud-run-task-webhook-trigger-in-blink "Direct link to Creating a Terraform Cloud Run Task Webhook trigger in Blink")

The integration generates a unique endpoint URL in Blink. You will use this URL as the Webhook URL when you create a Run Task in Terraform Cloud.

1. From your Blink workspace, click **Add Automation**.

2. Enter **Automation name** and select in which Pack to place the new Automation.

3. In **Type of trigger**, select **Event-based Automation**.

   <img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Terraform/RunTasks1.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=3d021f11f776c27b8185a7b2b8b37d59" alt="RunTasks1" width="595" height="633" data-path="img/Terraform/RunTasks1.png" />

4. Select **Terraform Cloud**, **Run Task Webhook Event** > **Continue**. The **Trigger setup** dialog box opens.

   <img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Terraform/RunTasks2.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=b94749679ba4607696ce76751e638c62" alt="RunTasks2" width="1242" height="720" data-path="img/Terraform/RunTasks2.png" />

5. Copy the **Webhook URL**. You need this to create a Run task in Terraform Cloud.

   <img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Terraform/RunTasks3.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=96fe1285a64de8f9885dc50600cdbf90" alt="RunTasks3" width="1137" height="660" data-path="img/Terraform/RunTasks3.png" />

## Creating a Run Task in Terraform Cloud[​](#creating-a-run-task-in-terraform-cloud "Direct link to Creating a Run Task in Terraform Cloud")

1. In Terraform cloud, go to **Workspaces** > **Select a workspace** > **Settings** > **Run tasks**.

   <img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Terraform/RunTasks4.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=cfe5e073665ea5d85adfbf20b2afdf46" alt="RunTasks4" width="2541" height="952" data-path="img/Terraform/RunTasks4.png" />

2. Click **Create a new Run Task**. **Create a Run Task** page opens.

3. Enter all values on the **Create a Run Task** page.

   * Select enable *Run task will run across all workspaces*.
   * Name: Select a meaningful name.
   * Endpoint URL: Paste the copied Blink Webhook URL.
   * Description: Describe what the Run Task is (optional).

   <img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Terraform/RunTasks5.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=b25eac3b626ee834fac702c81aae8853" alt="RunTasks5" width="2527" height="1150" data-path="img/Terraform/RunTasks5.png" />

4. Click **Create run task**. **Run Tasks** opens.

5. Under \*Available Run Tasks**, next to relevant Run Task, click** +**.** Associated Run Task\*\* page opens.

6. Under **Run stage**, select your desired run stage. The Blink integration works with all run stages. Under **Enforcement level**, select **Advisory** or **Mandatory** according to your preference.

   <img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Terraform/RunTasks6.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=755dfefa427ec130e9bf3eb9d4704808" alt="RunTasks6" width="2542" height="973" data-path="img/Terraform/RunTasks6.png" />

7. Click **Create**.

## Adding a Run Task Callback in a Blink automation[​](#adding-a-run-task-callback-in-a-blink-automation "Direct link to Adding a Run Task Callback in a Blink automation")

In order for the Run Task to finish successfully, the Blink automation must return a callback request to Terraform Cloud. This can be done using the **Terraform Cloud Run Task Callback** action.

1. In the Blink platform, in the **Edit** page of your Automation, click the empty space under **Steps** > **Action** > **Run Task Callback**.
2. In the **Run Task Callback\*\*\*\*Callback URL** and **Access Token**: It is recommended to leave the default values pre-defined in this action. Enter the rest of the parameters by your preference.
3. In the top-right corner of the canvas, **Publish** the Automation.

<img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Terraform/RunTasks7.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=0247817fd75ceb1552d48376faef4d4b" alt="RunTasks7" width="942" height="399" data-path="img/Terraform/RunTasks7.png" />
