CatSCAN: Terraform Cloud multi-workspace scanner. Secure observability tool for your organization's workspaces.
Project description
CatSCAN v2.0 ๐พ
Terraform Cloud multi-workspace scanner with retro vibes
CatSCAN is a secure, high-performance CLI tool that uses the Terraform Cloud API to scan all workspaces in your organization and display a comprehensive summary of resources. Built for platform and DevOps engineers who want secure, high-performance visibility across all Terraform workspaces.
CatSCAN uses the Terraform Cloud API v2 for authentication, workspace queries, and state analysis.
Follow the launch post on LinkedIn for discussion and feature requests.
Features
Core Functionality
- Comprehensive Scanning - Fetches all workspaces from Terraform Cloud with pagination support
- Deep State Analysis - Downloads and parses state files (JSON/ZIP) with nested module support
- Resource Discovery - Counts and categorizes all resource types across workspaces
- Parallel Processing - Multi-threaded scanning with configurable worker pools
- Connection Pooling - Efficient HTTP session management for faster API calls
Security & Authentication
- Keyring Integration - Secure credential storage using system keyring (encrypted)
- Multiple Auth Methods - Environment variables, keyring, or interactive input
- Input Validation - Sanitization of organization names and API tokens
- Credential Management - Built-in UI for updating/deleting stored tokens
User Interface
- Retro ASCII Art - Old-school terminal aesthetics for the modern DevOps warrior
- Rich Terminal UI - Beautiful tables and panels powered by Rich library
- Cross-Platform - Native support for Windows, macOS, and Linux
- Curses Mode - Buttery-smooth navigation on Linux terminals
Data & History
- Historical Tracking - Maintains scan history with detailed resource breakdowns
- Interactive History Browser - Navigate past scans with arrow keys
- Persistent Storage - Scan results saved in JSON format
- Detailed Views - Drill down into specific scans and workspace resources
๐ฆ Installation
From GitHub (Recommended for v2.0)
git clone https://github.com/cloudsifar/catscan-2.0.git
cd catscan-2.0
pip install -e .
From PyPI
pip install catscan-terra
๐ฎ Usage
Basic Commands
# Run CatSCAN with default settings
catscan
# Enable debug logging
catscan --debug
# Custom log file
catscan --log-file /path/to/catscan.log
# Skip the ASCII banner (for automation)
catscan --no-banner
Authentication Methods
Method 1: Secure Keyring Storage (Recommended)
On first run, CatSCAN will prompt for your credentials and offer to store them securely:
๐ Secure Configuration Setup
โ
Keyring available - credentials will be stored securely
Your token will be encrypted in the system credential store
Organization name: my-terraform-org
Terraform Cloud API Token: **********************
๐พ Save token securely to system keyring? (Y/n): y
Method 2: Environment Variables
For CI/CD pipelines or automation:
export TFC_ORG_NAME="my-terraform-org"
export TFC_TOKEN="your-api-token-here"
catscan
Security Tips for Environment Variables:
- Never commit
.envfiles to version control - Use CI/CD secret management features
- On Linux/Mac: Add to
~/.bashrcor~/.zshrcwith restricted permissions - On Windows: Use User Environment Variables (not System)
- Consider using tools like
direnvordotenvfor project-specific variables
Method 3: Interactive Input
Simply run catscan without any configuration, and it will guide you through setup.
๐ฏ Menu Navigation
Main Scan Results Menu
After completing a scan, you'll see:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ What would you like to do? โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ [D] View detailed results โ โ See all resources by type โ
โ โ [H] View scan history โ โ Browse previous scans โ
โ โ [R] Run another scan โ โ Refresh data โ
โ โ [S] Security settings โ โ Manage stored credentials โ
โ โ [P] Platform info (debug) โ โ Troubleshooting info โ
โ โ [Q] Quit โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
History Browser Controls
- โ/โ - Navigate through scan history
- Enter - View detailed scan results
- Escape - Return to main menu
- Page Up/Down - Jump through pages (Linux/curses mode)
Credential Manager
Access via [S] Security settings:
- View all organizations with stored tokens
- Verify token validity
- Update expired tokens
- Delete stored credentials
๐ Example Output
Scan Summary
Found 42 workspaces
๐ Deployed Resources by Workspace (acme-corp)
โโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโ
โ Workspace โ Resources โ Status โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ prod-app โ aws_instance(12), aws_db_instance(3), aws_security_group(8) โ โ
23 โ
โ staging โ aws_s3_bucket(5), aws_lambda_function(8) โ โ
13 โ
โ dev-a โ aws_instance(5), aws_cloudwatch_log_group(2), aws_iam_role(3) โ โ
10 โ
โ dev-b โ aws_lambda_function(6), aws_iam_policy(2), aws_sqs_queue(2) โ โ
10 โ
โ data-pipeline โ aws_glue_job(4), aws_glue_catalog_table(2), aws_s3_bucket(2) โ โ
8 โ
โ billing-analytics โ aws_athena_database(1), aws_athena_table(2), aws_s3_bucket(2) โ โ
5 โ
โ security-hub โ aws_guardduty_detector(1), aws_securityhub_standards_subscription(2)โ โ
3 โ
โ dev-c โ aws_instance(4), aws_ecr_repository(3), aws_codebuild_project(2) โ โ
9 โ
โ qa-env โ aws_instance(3), aws_rds_cluster(2), aws_elasticache_cluster(1) โ โ
6 โ
โ prod-infra โ aws_nat_gateway(2), aws_route_table(3), aws_vpc(1) โ โ
6 โ
โ devops โ aws_codepipeline(2), aws_codebuild_project(2), aws_iam_role(2) โ โ
6 โ
โ ml-models โ aws_sagemaker_model(3), aws_s3_bucket(2), aws_lambda_function(2) โ โ
7 โ
โ iot-core โ aws_iot_thing(5), aws_lambda_function(3), aws_dynamodb_table(2) โ โ
10 โ
โ user-auth โ aws_cognito_user_pool(2), aws_lambda_function(2), aws_iam_role(1) โ โ
5 โ
โ prod-db โ aws_rds_cluster(3), aws_db_subnet_group(1), aws_kms_key(1) โ โ
5 โ
โ legacy-archive โ aws_s3_bucket(2), aws_glacier_vault(2) โ โ
4 โ
โ sandbox โ No state โ ๐ซ No State โ
โ testing โ No state โ ๐ซ No State โ
โ temp-experiment โ No state โ ๐ซ No State โ
โ prototype-1 โ No state โ ๐ซ No State โ
โโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ
โ
Scan Complete!
Successfully processed: 37 workspaces
Empty/Error workspaces: 5
Total resources discovered: 159
โ Including nested modules
Detailed Resource View
All Resources by Type and Workspace (acme-corp)
โโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโ
โ Workspace โ Resource Type โ Count โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ prod-app โ aws_instance โ 12 โ
โ โ aws_db_instance โ 3 โ
โ โ aws_security_group โ 8 โ
โ โ aws_iam_role โ 2 โ
โ โ aws_cloudwatch_log_group โ 1 โ
โ โ aws_elb โ 1 โ
โ โ aws_launch_template โ 2 โ
โ โ aws_autoscaling_group โ 1 โ
โ โ aws_kms_key โ 1 โ
โ โ aws_route53_record โ 3 โ
โ โ aws_acm_certificate โ 2 โ
โ โ aws_s3_bucket โ 2 โ
โ โ aws_secretsmanager_secret โ 1 โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ staging โ aws_s3_bucket โ 5 โ
โ โ aws_lambda_function โ 8 โ
โ โ aws_iam_policy โ 2 โ
โ โ aws_api_gateway_rest_api โ 1 โ
โ โ aws_cloudwatch_alarm โ 3 โ
โ โ aws_dynamodb_table โ 1 โ
โ โ aws_sns_topic โ 1 โ
โ โ aws_ssm_parameter โ 2 โ
โโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโ
๐ง Logging and Debugging
Debug Mode
Enable comprehensive logging to troubleshoot issues:
# Logs to default location: ./catscan_YYYYMMDD_HHMMSS.log
catscan --debug
# Custom log location
catscan --log-file /var/log/catscan.log --debug
Log Levels
The debug log includes:
- API request/response details
- Authentication flow
- Token verification steps
- Workspace processing progress
- Rate limiting information
- Error stack traces
Common Issues
- Keyring not available: Install with
pip install keyring - Curses UI issues: Set
CATSCAN_NO_CURSES=trueto disable - Rate limiting: CatSCAN automatically handles Terraform Cloud rate limits
- SSL errors: Check your system certificates or corporate proxy settings
๐๏ธ Architecture
CatSCAN v2.0 features a fully modular architecture:
catscan/
โโโ auth/ # Authentication & credential management
โโโ api/ # Terraform Cloud API client
โโโ scanner/ # Core scanning logic
โโโ storage/ # Data persistence
โโโ ui/ # Terminal user interface
โโโ utils/ # Cross-platform utilities
๐ค Contributing
I welcome suggestions and improvements! If you're new to GitHub or pull requests don't worry โ here's the usual workflow:
- Fork the repository on GitHub to your own account.
- Clone your fork locally:
git clone https://github.com/<your-username>/catscan-2.0.git cd catscan-2.0
- Create a feature branch:
git checkout -b feature/my-feature
- Make your changes, then commit them:
git add . git commit -m "Describe your change here"
- Push the branch to your fork:
git push origin feature/my-feature
- Open a Pull Request against
cloudsifar/catscan-2.0via GitHub's UI.- You'll automatically be notified of comments, CI results, and merge status.
- I review and manually merge when ready.
Feel free to open issues first if you want to discuss big changes or report bugs.
๐จโ๐ป Author
Simon Farrell โ Creator of CatSCAN and Terraform enthusiast.
Follow me on LinkedIn for updates.
๐ License
This project is licensed under the MIT License.
๐ธ Why CatSCAN?
Because every DevOps team needs a tool that makes infrastructure scanning feel less like work and more like playing with a retro terminal from the 80s. I was inspired because I wanted something like a cat command in bash, which scanned my workspaces and displayed it in the terminal. Plus I like cats.
/\_ _/\
( o.o ) Meow! Found 42 workspaces to scan...
)==Y==(
/ \
( | || | )
\__\_/\_/__/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file catscan_terra-2.0.0.tar.gz.
File metadata
- Download URL: catscan_terra-2.0.0.tar.gz
- Upload date:
- Size: 40.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba40772958dd8dc7fdcd60ef1d8698e7696650a80f954d8e1b117c4fe0872c91
|
|
| MD5 |
176ab9c8dba8e55675929a443d37edc0
|
|
| BLAKE2b-256 |
8ecf4f7ae592660f6adf2aacbf267b4992383ad15c32d7418488dd2013da2c3d
|
File details
Details for the file catscan_terra-2.0.0-py3-none-any.whl.
File metadata
- Download URL: catscan_terra-2.0.0-py3-none-any.whl
- Upload date:
- Size: 45.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b1511887eae7595b1f322391fe5661ba65c468a8cede0e7e3e0c630cd0e745e
|
|
| MD5 |
84d26bc9f5b683e35b8328862fe31ca4
|
|
| BLAKE2b-256 |
ba672c68efbd12d099c64650843c85fdba45423798452f0d4536addc3d155aeb
|