For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Webhooks

Manage Workspaces permission is required to perform this action, please check Team Management for more info.

Webhooks let a Version Control workflow workspace react automatically to activity in its git repository: kicking off a plan/apply job on a push, or posting plan and apply results as comments on a pull request. This page covers the Webhook tab inside a workspace's settings. For connecting Terrakube to your VCS account in the first place, see VCS Providers.

Enabling the webhook

Open a workspace, go to Settings > Webhook, and turn on Enable VCS Webhook?. Once enabled, Terrakube registers a webhook with your VCS provider and shows its remote ID.

If several workspaces use the same repository, tick Share one webhook across this repository when enabling (GitHub, GitLab, Azure DevOps and Azure SP/MI) so Terrakube registers a single webhook for all of them. An existing workspace can use Migrate to shared webhook and Switch to a webhook for this workspace to move either way. If a shared webhook is deleted on the provider, Terrakube recreates it.

Changing the workspace's repository or VCS provider removes its webhook first, because the old webhook belongs to the old repository. Set it up again afterwards from this page.

Webhook events

Each row in the events table matches a specific kind of repository activity to a template:

Field
Description

Priority

Events are checked top to bottom and the first match wins. Use the arrows to reorder; the order is saved as priority 1, 2, 3.

Event

Push, Pull Request, or Release. See provider support below — not every VCS supports every event type.

Branch/release

One chip per branch or release pattern (a regex), each validated on its own. Any branch matches everything. Use Test patterns to try a sample branch or path.

Path Type

Pattern for simple wildcards like terraform/* or modules/**, or Regex for full regular-expression matching against changed files. Branch/release matching always uses regex regardless of this setting.

File

The pattern or regex list (depending on Path Type) that changed files must match for the job to run. Useful for monorepos so unrelated changes don't trigger a run.

Template

The Templates to run when this event matches.

Posting plan and apply results on pull requests

For Pull Request events, two independent switches control an Atlantis/TFE-style PR comment workflow:

Toggle
Effect

Post Plan on PR

Terrakube posts the plan output as a comment on the pull request, and accepts terrakube plan PR comments to re-run the plan.

Allow Apply via PR Comment

Accepts terrakube apply PR comments to run the workspace's default template with auto-apply. Only selectable once Post Plan on PR is enabled.

If Allow Apply via PR Comment is off, the plan comment shows a notice instead of the apply instructions, and a terrakube apply comment gets a reply explaining apply is disabled rather than being silently ignored:

Ask a workspace admin to enable Allow Apply via PR Comment in the Webhook settings, or apply the plan from the Terrakube UI.

What a plan comment looks like:

  • A header with the workspace name, status, and a link back to the run in the Terrakube UI.

  • A status icon (✅ / ❌ / ⚠️) and a one-line summary (e.g. Plan: 2 to add, 0 to change, 0 to destroy. or No changes.).

  • The full plan output in a collapsible, diff-highlighted block.

  • A footer inviting terrakube apply (only when enabled) and terrakube plan to re-run.

Replans update the existing comment. Pushing new commits to the same PR edits the existing plan comment in place instead of posting a new one every time — if the edit fails (for example the original comment was deleted), Terrakube falls back to posting a new comment. Apply results always post as their own separate comment, so the apply history is never overwritten.

Command acknowledgment. As soon as Terrakube recognizes a terrakube plan or terrakube apply comment, it reacts to that comment with 👀 so you know it was seen. Once the triggered job finishes, the reaction updates to ✅ (success) or ❌ (failure). Bitbucket has no comment-reaction API, so acknowledgment is a no-op there — Bitbucket users still get the plan/apply result comment itself.

GitHub pull request with a Terrakube plan comment
GitLab merge request with a Terrakube plan comment

Provider support

Provider
Push
Pull Request
Release
Post Plan on PR / Apply via PR Comment

✅

✅

✅

✅ (with 👀→✅/❌ reactions)

✅

✅

✅

✅ (with 👀→✅/❌ reactions)

✅

✅

✅

✅ (with 👀→✅/❌ award emoji)

✅

✅

✅

✅ (no reactions — no comment-reaction API)

✅

✅

–

Not yet supported

–

–

–

–

Azure DevOps triggers push and pull-request jobs via service hooks (or outbound polling on private networks — see Azure DevOps), but the PR comment plan/apply workflow above is currently only available for GitHub, GitLab, and Bitbucket. SSH-based repositories have no webhook support at all; runs must be triggered manually, via the API, or on a schedule.

Branch restrictions in 2.34.0

When restrictApplyToConfiguredBranch is enabled, pushes can use apply/destroy templates only on the workspace's configured branch. PR events and PR comment commands can use only plan-only templates, regardless of branch name; apply from a PR comment is disabled. A refused event starts no job, and a refused comment command receives a PR notice.

Release events can start their configured template, but the executor verifies that the commit belongs to the configured branch before apply/destroy. Protect release publishing in the VCS. Workspaces with the setting off retain their previous behavior. See Run Restrictions for the full source-by-source rules.

Last updated

Was this helpful?