> For the complete documentation index, see [llms.txt](https://docs.terrakube.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.terrakube.io/2.34.0/run-terraform/workspaces/run-triggers.md).

# Run Triggers

A run trigger links two workspaces in the same organization: when the **source** workspace finishes a run that changed infrastructure, Terrakube queues a run in the **destination** workspace. Use it when one workspace consumes the outputs of another, for example a VPN workspace that reads a VPC workspace's outputs, so the dependent workspace does not silently drift.

{% hint style="info" %}
Available from Terrakube 2.34.0.
{% endhint %}

```mermaid
flowchart LR
    vpc[vpc] -->|apply changed state| vpn[vpn]
    vpc --> dns[dns]
    vpn --> app[app]
    dns --> app
```

Applying `vpc` queues runs in `vpn` and `dns`. When both of those apply, `app` runs after each.

### Configure a trigger

Open the destination workspace and select **Run Triggers** in the workspace menu.

* **Runs after** lists the workspaces whose applies start a run here. Add a source workspace, optionally choose a template (otherwise the destination's default template is used), and toggle a trigger on or off.
* **Triggers** lists the workspaces that run after this one. It is read-only here; change those from the other workspace.

Runs started this way say so in the run header and link to the upstream run.

<figure><img src="https://1229094460-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTN6M529qVFnas8hChf2y%2Fuploads%2Fgit-blob-3131e4eeb11c37473ff1987af6e88243e4c8745a%2Frun-triggers.png?alt=media" alt="The Run Triggers page of a workspace"><figcaption><p>The Run Triggers page of a workspace</p></figcaption></figure>

### What fires a trigger

* Only a run that **applies, destroys or runs custom scripts** fires a trigger. A plan-only run fires nothing.
* If the destination is locked or busy, its run is queued rather than skipped.
* Triggers cascade: a destination can itself be the source of other triggers.

### Rules

* You need manage rights on the destination workspace, and must be able to see the source.
* Terrakube rejects a trigger that would create a loop, and names the path in the error.
* The two workspaces of a trigger cannot be changed once created. Delete it and create another.

### Limits

Two safety bounds, set on the API:

| Property                                            | Default | Meaning                                        |
| --------------------------------------------------- | ------- | ---------------------------------------------- |
| `io.terrakube.run-trigger.max-cascade-depth`        | `10`    | Longest chain of runs started by one apply.    |
| `io.terrakube.run-trigger.max-dependents-per-apply` | `20`    | Most workspaces one apply can trigger.         |
| `io.terrakube.run-trigger.enabled`                  | `true`  | Turns run triggers off for the whole instance. |

Triggers are also available over the API as the `runTrigger` resource (`sourceWorkspace`, `destinationWorkspace`, `template`, `enabled`).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.terrakube.io/2.34.0/run-terraform/workspaces/run-triggers.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
