0.2.5 • Published 5 months ago
@androbinco/robin-terraform v0.2.5
Robin Terraform CLI
CLI tool to fetch Terraform configurations for GCP and AWS services.
Installation
Global Installation
# Using npm
npm install -g @androbinco/robin-terraform
# Using pnpm
pnpm add -g @androbinco/robin-terraformUsing npx (No Installation Required)
You can use the CLI without installing it globally by using npx:
# Basic usage
npx @androbinco/robin-terraform fetch gcp cloudrun
# List available services
npx @androbinco/robin-terraform list
# Show configuration files
npx @androbinco/robin-terraform show gcp cloudrun
# Clean up
npx @androbinco/robin-terraform cleanLocal Development
If you're working on the CLI locally:
# Clone the repository
git clone https://github.com/your-org/robin_monorepo-cli.git
cd robin_monorepo-cli
# Install dependencies
pnpm install
# Run the CLI locally
pnpm --filter @androbinco/robin-terraform start
# Or use npx with local path
npx ./packages/robin-terraform-cli/src/index.js fetch gcp cloudrunUsage
Fetch Terraform configuration
# Interactive mode - shows provider selection then service
robin-terraform fetch
# Fetch specific provider and service
robin-terraform fetch gcp cloudrun
robin-terraform fetch gcp lb
robin-terraform fetch gcp cloudbuild
robin-terraform fetch gcp bucket
robin-terraform fetch gcp databaseSpecify target directory
robin-terraform fetch gcp cloudrun --path ./infrastructureForce overwrite
robin-terraform fetch gcp cloudrun --forceList available configurations
# List all providers and services
robin-terraform list
# List services for specific provider
robin-terraform list gcp
# Show all with --list flag
robin-terraform fetch --listPreview configuration files
# List files in a configuration
robin-terraform show gcp cloudrun
# View specific file
robin-terraform show gcp cloudrun main.tf
robin-terraform show gcp cloudrun variables.tfClean up
# Remove terraform directory when done
robin-terraform clean
# Remove specific directory
robin-terraform clean --path ./infrastructureAvailable Services
GCP
cloudrun- Cloud Run service deploymentlb- Load Balancer configurationcloudbuild- Cloud Build CI/CD pipelinebucket- Cloud Storage bucketsdatabase- Cloud SQL instance
Complete Workflow Example
# 1. Create new project
mkdir my-api && cd my-api
# 2. Get Terraform config for GCP Cloud Run
robin-terraform fetch gcp cloudrun
# 3. Deploy
cd terraform
terraform init
terraform plan
terraform apply
# 4. Clean up
cd ..
robin-terraform cleanOptions
| Command | Options | Description |
|---|---|---|
| fetch | --path, -p | Target directory (default: ./terraform) |
| fetch | --force, -f | Overwrite existing directory |
| fetch | --list, -l | List all providers and services |
| list | provider | Optional: specific provider to list |
| show | Requires: provider, service, file | |
| clean | --path, -p | Directory to remove (default: ./terraform) |
Examples
Basic usage
# Quick fetch for different services
robin-terraform fetch gcp cloudrun
robin-terraform fetch gcp lb
# Interactive selection
robin-terraform fetch
# Preview before fetching
robin-terraform show gcp cloudrun main.tf
robin-terraform fetch gcp cloudrunMulti-service deployment
# API service
robin-terraform fetch gcp cloudrun --path ./services/api/terraform
# Load Balancer
robin-terraform fetch gcp lb --path ./services/lb/terraform
# Database
robin-terraform fetch gcp database --path ./services/database/terraform
# Storage
robin-terraform fetch gcp bucket --path ./services/storage/terraformWorking with existing projects
# Check what you're about to overwrite
robin-terraform show gcp cloudrun
# Force update existing terraform
robin-terraform fetch gcp cloudrun --force
# Clean up after deployment
robin-terraform cleanTips
- Always review
variables.tfafter fetching to set your project-specific values - Use
--pathflag to organize multiple terraform configurations - Run
terraform planbeforeapplyto review changes - Use
robin-terraform cleanto remove terraform files when done - Keep your terraform state files in a backend (GCS, S3) for team collaboration
Updating
# Check current version
robin-terraform --version
# Update to latest
npm update -g @androbinco/robin-terraform
# or
pnpm update -g @androbinco/robin-terraform