Skip to main content

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 .env files to version control
  • Use CI/CD secret management features
  • On Linux/Mac: Add to ~/.bashrc or ~/.zshrc with restricted permissions
  • On Windows: Use User Environment Variables (not System)
  • Consider using tools like direnv or dotenv for 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

  1. Keyring not available: Install with pip install keyring
  2. Curses UI issues: Set CATSCAN_NO_CURSES=true to disable
  3. Rate limiting: CatSCAN automatically handles Terraform Cloud rate limits
  4. 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:

  1. Fork the repository on GitHub to your own account.
  2. Clone your fork locally:
    git clone https://github.com/<your-username>/catscan-2.0.git
    cd catscan-2.0
    
  3. Create a feature branch:
    git checkout -b feature/my-feature
    
  4. Make your changes, then commit them:
    git add .
    git commit -m "Describe your change here"
    
  5. Push the branch to your fork:
    git push origin feature/my-feature
    
  6. Open a Pull Request against cloudsifar/catscan-2.0 via 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

catscan_terra-2.0.0.tar.gz (40.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

catscan_terra-2.0.0-py3-none-any.whl (45.2 kB view details)

Uploaded Python 3

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

Hashes for catscan_terra-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ba40772958dd8dc7fdcd60ef1d8698e7696650a80f954d8e1b117c4fe0872c91
MD5 176ab9c8dba8e55675929a443d37edc0
BLAKE2b-256 8ecf4f7ae592660f6adf2aacbf267b4992383ad15c32d7418488dd2013da2c3d

See more details on using hashes here.

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

Hashes for catscan_terra-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b1511887eae7595b1f322391fe5661ba65c468a8cede0e7e3e0c630cd0e745e
MD5 84d26bc9f5b683e35b8328862fe31ca4
BLAKE2b-256 ba672c68efbd12d099c64650843c85fdba45423798452f0d4536addc3d155aeb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page