Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

terraform-webhooks

БесплатноЗапускает вложенные скриптыНе проверен

Receive and verify HCP Terraform (Terraform Cloud) and Terraform Enterprise notification webhooks. Use when setting up Terraform run notification handlers…

hookdeckот hookdeck★ 104 звезды на GitHub

Об этом скилле

Terraform Webhooks

HCP Terraform (formerly Terraform Cloud) and Terraform Enterprise send workspace notifications to any HTTP endpoint using the generic destination type. This skill covers that destination only; Slack, Microsoft Teams, and email use their own formats.

When to Use This Skill

  • How do I receive HCP Terraform / Terraform Cloud run notification webhooks?
  • How do I verify the X-TFE-Notification-Signature header?
  • How do I handle run:completed, run:errored, or run:needs_attention notifications?
  • How do I react to drift detection (assessment:drifted) or failed health assessments?
  • Why is my Terraform notification configuration failing verification or not enabling?

Verification (core)

The signature is the hex HMAC-SHA512 of the raw request body, keyed with the notification configuration's token, sent in X-TFE-Notification-Signature. The token is optional in HCP Terraform: if you don't set one, no signature is sent, so set one and reject unsigned requests.

const crypto = require('crypto');

function verifyTerraformSignature(rawBody, signatureHeader, token) {
  if (!signatureHeader || !token) return false;
  const expected = crypto.createHmac('sha512', token).update(rawBody).digest('hex');
  try {
    const received = Buffer.from(signatureHeader.toLowerCase());
    const expectedBuf = Buffer.from(expected);
    return received.length === expectedBuf.length && crypto.timingSafeEqual(received, expectedBuf);
  } catch {
    return false;
  }
}
import hmac, hashlib

def verify_terraform_signature(raw_body: bytes, signature_header: str, token: str) -> bool:
    if not signature_header or not token:
        return False
    expected = hmac.new(token.encode(), raw_body, hashlib.sha512).hexdigest()
    return hmac.compare_digest(signature_header.lower().encode(), expected.encode())

In Express, read the body with express.raw({ type: '*/*' }) so the signature verifies whatever Content-Type the request carries.

For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/.

Verification Request

When you save a configuration with Enabled on, or click Send a test, HCP Terraform POSTs a test payload whose notifications[0].trigger is "verification" (run fields are null). Return any 2xx; the configuration can't be enabled otherwise. HashiCorp says all generic notification requests are signed when a token is set, so have the token in your handler first. The docs don't mention this request by name, so check Last Response if enabling fails.

Triggers

Run payloads (payload_version: 1) carry the trigger in notifications[].trigger, which holds the run's state, and the configured trigger in notifications[].trigger_type. HashiCorp's example pairs run:errored with run:run_canceled. Workspace payloads (payload_version: "2") carry it in a top-level trigger.

Trigger Fires When
run:created A run is created and enters the Pending stage
run:planning A run acquires the lock and starts executing
run:needs_attention A plan has changes and needs approval or a policy override
run:pending_apply_approval A run waits for approval before applying
run:cost_estimated Cost estimation finishes
run:policy_override_required A run needs a policy override to proceed
run:policies_checked Policy checks finish
run:applying A run enters the Apply stage
run:completed A run completes successfully
run:errored A run ends early (the state sent in trigger)
run:run_errored An error stops a run (in trigger_type)
run:run_canceled A run is canceled (in trigger_type)
run:policy_soft_failed A soft-mandatory policy check fails (in trigger_type)
assessment:drifted Drift detected (health assessments enabled)
assessment:check_failure Continuous validation checks failed
assessment:failed A health assessment itself failed
workspace:auto_destroy_reminder An automatic destroy run is imminent
workspace:auto_destroy_run_results An automatic destroy run was attempted (HashiCorp's sample payloads say workspace:auto_destroy_results, so accept both)
workspace:deleted A workspace was deleted
change_request:created A change request is created (team configurations; the payload has no trigger field)
verification Test request sent on enable / "Send a test"

Run payload fields: payload_version, notification_configuration_id, run_url, run_id, run_message, run_created_at, run_created_by, workspace_id, workspace_name, organization_name, and notifications[] (message, trigger, trigger_type, run_status, run_updated_at, run_updated_by).

For the full payload reference, see [Notification configurations API](https://develo

Полный SKILL.md на GitHub

Установить terraform-webhooks в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

examples/express/.env.exampleexamples/express/README.mdexamples/express/package.jsonexamples/express/src/index.jsexamples/fastapi/.env.exampleexamples/fastapi/README.mdexamples/fastapi/main.pyexamples/fastapi/requirements.txtexamples/fastapi/test_webhook.pyexamples/nextjs/.env.exampleexamples/nextjs/README.mdexamples/nextjs/app/webhooks/terraform/route.tsexamples/nextjs/lib/terraform.tsexamples/nextjs/package.jsonexamples/nextjs/vitest.config.tsreferences/overview.mdreferences/setup.mdreferences/verification.md

FAQ

Что делает скилл terraform-webhooks?

Receive and verify HCP Terraform (Terraform Cloud) and Terraform Enterprise notification webhooks. Use when setting up Terraform run notification handlers, debugging X-TFE-Notification-Signature verification, or handling triggers like run:completed, run:errored, run:needs_attention, and assessment:drifted.

Как установить скилл terraform-webhooks?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл terraform-webhooks запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить terraform-webhooks с