GitHunt
JM

jmcvetta/tfc-cancel-pending

Script to cancel pending runs on a Terraform Cloud workspace

tfc-cancel-pending

Script to cancel pending runs on a Terraform Cloud workspace

Caution

Footgun Warning: This software has no safety bumpers. It is easy to shoot
yourself in the foot. Be careful!

Install

For development

# Install dependencies using uv
uv sync

As a package

# Install from current directory
pip install .

# Or with uv
uv pip install .

After installation as a package, the tfc-cancel-pending command will be available system-wide.

Usage

# Cancel pending runs
make cancel <organization> <workspace>

# Dry run (see what would be cancelled without actually cancelling)
make cancel-dry-run <organization> <workspace>

# Show help
make help

Direct script usage

# Using the console command (recommended)
uv run tfc-cancel-pending <organization> <workspace> [--dry-run]

# Or run the script directly
uv run python tfc_cancel_pending.py <organization> <workspace> [--dry-run]

# Or make the script executable
chmod +x tfc_cancel_pending.py
./tfc_cancel_pending.py <organization> <workspace> [--dry-run]

If you already have the Terraform CLI authorized with Terraform
Cloud, tfc-cancel-pending will automatically read your TFC API token from the
Terraform CLI's credentials file.

Otherwise, you must populate environment variable TFC_TOKEN with your
Terraform Cloud API token.

Languages

Python74.0%Makefile26.0%

Contributors

MIT License
Created March 15, 2023
Updated December 15, 2025
jmcvetta/tfc-cancel-pending | GitHunt