Skip to main content

Troubleshooting Guide

Installation Issues

Command not found after installation

Symptoms:

terraback: command not found

Solutions:

  1. Verify pip installation location:
pip show terraback
  1. Check if the install location is in PATH:
# Find where pip installs scripts
python -m site --user-base

# Add to PATH if needed (Linux/macOS)
export PATH=$PATH:$(python -m site --user-base)/bin
  1. Try reinstalling:
pip uninstall terraback
pip install terraback

Python version error

Symptoms:

Error: Python 3.8 or higher required

Solution: Install Python 3.8+ from python.org or use pyenv:

pyenv install 3.11
pyenv global 3.11
pip install terraback

Permission denied during installation

Symptoms:

Error: Permission denied

Solutions:

# Option 1: Use virtual environment (recommended)
python -m venv terraback-env
source terraback-env/bin/activate
pip install terraback

# Option 2: Install for user only
pip install --user terraback

Authentication Issues

AWS credentials not found

Symptoms:

Error: Unable to locate credentials

Solutions:

  1. Configure AWS CLI:
aws configure
  1. Or set environment variables:
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_DEFAULT_REGION="us-east-1"
  1. Verify credentials:
aws sts get-caller-identity

Azure authentication failed

Symptoms:

Error: Azure authentication failed

Solutions:

  1. Login with Azure CLI:
az login
  1. Or use service principal:
export AZURE_CLIENT_ID="your-client-id"
export AZURE_CLIENT_SECRET="your-client-secret"
export AZURE_TENANT_ID="your-tenant-id"
export AZURE_SUBSCRIPTION_ID="your-subscription-id"
  1. Verify authentication:
az account show

GCP authentication failed

Symptoms:

Error: GCP authentication failed

Solutions:

  1. Login with gcloud:
gcloud auth application-default login
  1. Or use service account:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
  1. Verify authentication:
gcloud auth list

Scanning Issues

No resources found

Symptoms:

No resources found in region us-east-1

Solutions:

  1. Verify you're scanning the correct region:
# Check which regions have resources
aws ec2 describe-instances --query 'Reservations[].Instances[].Placement.AvailabilityZone'
  1. Check permissions - you need read access:
# AWS: Ensure you have ReadOnlyAccess or equivalent
aws iam get-user
  1. Try scanning a specific service:
terraback aws s3 scan --output-dir ./output  # S3 is global

Permission denied during scan

Symptoms:

Error: Access Denied when calling DescribeInstances

Solutions:

  1. Check IAM permissions:
aws iam list-attached-user-policies --user-name your-username
  1. Ensure you have at least ReadOnlyAccess policy or equivalent permissions for the services you're scanning.

  2. For specific services, check the required permissions in AWS documentation.

API rate limiting / throttling

Symptoms:

Error: Rate exceeded
Error: Throttling

Solutions:

  1. Reduce parallel workers:
terraback scan all aws -r us-east-1 --parallel 2 -o ./output
  1. Enable caching to reduce API calls (caching is opt-in via --cache, off by default):
# First scan with --cache populates the cache
terraback scan all aws -r us-east-1 --cache -o ./output

# Subsequent scans with --cache reuse it (within the 60 minute TTL)
terraback scan all aws -r us-east-1 --cache -o ./output
  1. Scan specific services instead of all:
terraback aws ec2 scan-instances -r us-east-1 -o ./output
terraback aws s3 scan -o ./output

Scan timeout

Symptoms:

Error: Operation timed out

Solutions:

  1. Scan specific services instead of all resources
  2. Reduce parallel workers
  3. Try scanning during off-peak hours
  4. Check network connectivity

License Issues

License activation failed

Symptoms:

Error: License activation failed
Error: Invalid license key

Solutions:

  1. Verify license key format (should be XXXX-XXXX-XXXX-XXXX):
terraback license activate XXXX-XXXX-XXXX-XXXX
  1. Check internet connectivity - activation requires online validation

  2. Verify you're using the correct license key from your email

  3. Contact support if issue persists: contact@terraback.io

License not found

Symptoms:

Error: No valid license found
Feature requires Professional license

Solutions:

  1. Check license status:
terraback license status
  1. Re-activate if needed:
terraback license activate YOUR-LICENSE-KEY
  1. License file location:
    • Linux/macOS: ~/.terraback/license.jwt
    • Windows: %USERPROFILE%\.terraback\license.jwt

Output Issues

Generated Terraform has errors

Symptoms:

Error: Invalid resource configuration

Solutions:

  1. Validate generated files:
cd ./output
terraform init
terraform validate
  1. Check for missing dependencies - use --with-deps flag:
terraback aws ec2 scan-instances --with-deps -r us-east-1 -o ./output
  1. Review generated code for any cloud-specific issues

Import fails

Symptoms:

Error: Resource already managed by Terraform
Error: Cannot import non-existent resource

Solutions:

  1. Ensure resource exists in cloud:
aws ec2 describe-instances --instance-ids i-1234567890abcdef0
  1. Check if resource is already in state:
terraform state list
  1. Remove from state if re-importing:
terraform state rm aws_instance.example
terraform import aws_instance.example i-1234567890abcdef0

Cache Issues

Stale data in scans

Symptoms: Resources showing old configurations or deleted resources still appearing.

Solutions:

  1. Clear the cache:
terraback cache clear
  1. Invalidate specific service cache:
terraback cache invalidate --service ec2
  1. Check cache statistics:
terraback cache stats

Debug Mode

Enable verbose logging

# Set environment variables
export TERRABACK_LOG_LEVEL=DEBUG
export TERRABACK_LOG_FILE=/tmp/terraback.log

# Or use verbose flag
terraback aws ec2 scan-instances -v -r us-east-1 -o ./output

View debug logs

# Check log file
cat /tmp/terraback.log

# Or use tail for live viewing
tail -f /tmp/terraback.log

Getting Help

Before contacting support

  1. Verify authentication:
terraback scan auth-check
  1. Enable debug logging and capture the error

  2. Note the specific command and error message

Support channels

Information to include

When reporting issues, include:

  • Python version (python --version)
  • Operating system
  • Cloud provider and service
  • Full error message
  • Steps to reproduce