Command Palette

Search for a command to run...

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

tfc-run-status

БесплатноБез исполняемых скриптовНе проверен

Terraform Cloud run status with resource counts and actions. Use when polling a run, checking pass/fail, or seeing if it can be applied or canceled. Requires…

laurigatesот laurigates★ 61 звезда на GitHub13 установок в других каталогах

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

Terraform Cloud Run Status

Quick status check for Terraform Cloud runs with resource change counts, timestamps, and available actions.

When to Use This Skill

Use this skill when... Use a sibling instead when...
Checking whether a known run ID succeeded, failed, or is mid-flight Reading the full plan/apply log text (tfc-run-logs)
Polling a run until it reaches a final state Analyzing structured plan JSON for resource changes (tfc-plan-json)
Inspecting available actions (confirm/cancel/discard) on a run Listing or filtering many runs to discover an ID (tfc-list-runs)
Reading cost estimate or resource add/change/destroy counts Browsing latest runs for FVH workspaces (tfc-workspace-runs)

Prerequisites

# TFE_TOKEN: user or team token.
# Keep it in a secret manager and inject it into the command that needs it
# instead of exporting it, e.g. `fnox exec --only TFE_TOKEN -- <cmd>` or `op run -- <cmd>`.
export TFE_ADDRESS="app.terraform.io"    # Optional

Core Commands

Complete Status Check

#!/bin/bash
set -euo pipefail

TOKEN="${TFE_TOKEN:?TFE_TOKEN not set}"
BASE_URL="https://${TFE_ADDRESS:-app.terraform.io}/api/v2"
RUN_ID="${1:?Usage: $0 <run-id>}"

curl -sf --header "Authorization: Bearer $TOKEN" \
  "$BASE_URL/runs/$RUN_ID?include=plan,apply,cost-estimate" | \
  jq -r '
    "Run ID:      " + .data.id,
    "Status:      " + .data.attributes.status,
    "Message:     " + (.data.attributes.message // "No message"),
    "Created:     " + .data.attributes."created-at",
    "Has Changes: " + (.data.attributes."has-changes" | tostring),
    "Auto-Apply:  " + (.data.attributes."auto-apply" | tostring),
    "",
    "Resource Changes:",
    "  Additions:    " + ((.included[] | select(.type == "plans") | .attributes."resource-additions") // 0 | tostring),
    "  Changes:      " + ((.included[] | select(.type == "plans") | .attributes."resource-changes") // 0 | tostring),
    "  Destructions: " + ((.included[] | select(.type == "plans") | .attributes."resource-destructions") // 0 | tostring),
    "",
    "Actions:",
    "  Confirmable:     " + (.data.attributes.actions."is-confirmable" | tostring),
    "  Cancelable:      " + (.data.attributes.actions."is-cancelable" | tostring),
    "  Discardable:     " + (.data.attributes.actions."is-discardable" | tostring),
    "  Force-Cancelable:" + (.data.attributes.actions."is-force-cancelable" | tostring)
  '

Quick Status Only

TOKEN="${TFE_TOKEN:?TFE_TOKEN not set}"
RUN_ID="run-abc123"

curl -sf --header "Authorization: Bearer $TFE_TOKEN" \
  "https://app.terraform.io/api/v2/runs/$RUN_ID" | \
  jq -r '.data.attributes.status'

Status with Timestamps

curl -sf --header "Authorization: Bearer $TFE_TOKEN" \
  "https://app.terraform.io/api/v2/runs/$RUN_ID" | \
  jq -r '
    .data.attributes |
    "Status: " + .status,
    "Timestamps:",
    "  Created:   " + (."created-at" // "N/A"),
    "  Planned:   " + (."status-timestamps"."planned-at" // "N/A"),
    "  Applied:   " + (."status-timestamps"."applied-at" // "N/A")
  '

Check Available Actions

curl -sf --header "Authorization: Bearer $TFE_TOKEN" \
  "https://app.terraform.io/api/v2/runs/$RUN_ID" | \
  jq '.data.attributes.actions'

Check Permissions

curl -sf --header "Authorization: Bearer $TFE_TOKEN" \
  "https://app.terraform.io/api/v2/runs/$RUN_ID" | \
  jq '.data.attributes.permissions'

Poll Until Complete

#!/bin/bash
set -euo pipefail

TOKEN="${TFE_TOKEN:?TFE_TOKEN not set}"
RUN_ID="${1:?Usage: $0 <run-id>}"

FINAL_STATES="applied planned_and_finished planned_and_saved discarded errored canceled force_canceled policy_soft_failed"
# States that wait on a human (confirm / override); polling cannot advance them
AWAITING_STATES="planned policy_override"

TIMEOUT_SECS="${TFC_POLL_TIMEOUT:-1800}"   # wall-clock deadline, default 30 min
DEADLINE=$(( $(date +%s) + TIMEOUT_SECS ))

while [ "$(date +%s)" -lt "$DEADLINE" ]; do
  STATUS=$(curl -sf --header "Authorization: Bearer $TOKEN" \
    "https://app.terraform.io/api/v2/runs/$RUN_ID" | \
    jq -r '.data.attributes.status')

  echo "$(date +%H:%M:%S) Status: $STATUS"

  if echo "$FINAL_STATES" | grep -qw "$STATUS"; then
    echo "Run completed with status: $STATUS"
    exit 0
  fi

  if echo "$AWAITING_STATES" | grep -qw "$STATUS"; then
    echo "Run is waiting for a human action (status: $STATUS) — confirm or override it in Terraform Cloud"
    exit 0
  fi

  sleep 5
done

echo "Timed out after ${TIMEOUT_SECS}s; last status: ${STATUS:-unknown}" >&2
exit 1

The loop ends on a final state, on a state that only a human can advance, or at the deadline (TFC_POLL_TIMEOUT seconds, default 1800) — never open-ended.

JSON Output

Full Run Details

curl -sf --header "Authorization: Bearer $TFE_TOKEN" \
  "https://app.terraform.io/api/v2/runs/$RUN_ID" | \
  jq '{
    id: .data.id,
    status: .data.attr
Полный SKILL.md на GitHub

Установить tfc-run-status в Claude Code и Claude Desktop

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

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

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

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

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

Bash(curl *)
Bash(jq *)
Read

FAQ

Что делает скилл tfc-run-status?

Terraform Cloud run status with resource counts and actions. Use when polling a run, checking pass/fail, or seeing if it can be applied or canceled. Requires TFE_TOKEN.

Как установить скилл tfc-run-status?

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

Скилл tfc-run-status запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить tfc-run-status с