@androbinco/robin-terraform
v0.3.6
Published
CLI tool to fetch Terraform configurations for GCP and AWS services
Downloads
64
Maintainers
Readme
Robin Terraform CLI
CLI tool to fetch Terraform configurations for GCP and AWS services. Includes SOC2-compliant security layers.
Installation
Global Installation (Recommended)
# Using npm
npm install -g @androbinco/robin-terraform
# Verify installation
robin-terraform --versionUsing npx (No Installation Required)
npx @androbinco/robin-terraform fetch gcp cloudrun
npx @androbinco/robin-terraform listUninstall
npm uninstall -g @androbinco/robin-terraformQuick Start
# Interactive mode - guided selection
robin-terraform fetch
# Direct fetch
robin-terraform fetch gcp database
# List all available services
robin-terraform list gcpAvailable Services
GCP Core Services
| Service | Description |
|---------|-------------|
| cloudrun | Cloud Run service deployment |
| lb | Load Balancer configuration |
| cloudbuild | Cloud Build CI/CD pipeline |
| bucket | Cloud Storage buckets |
| database | Cloud SQL instance |
GCP SOC2 Security Layers
| Service | Description |
|---------|-------------|
| soc-layers/vpc | Private VPC network |
| soc-layers/private-service-connection | VPC peering for Cloud SQL private IP |
| soc-layers/vpc-connector | Serverless VPC Access for Cloud Run |
| soc-layers/firewall | SOC2 firewall rules (blocks DB ports) |
| soc-layers/cloud-armor | DDoS protection with rate limiting |
Usage
Fetch Terraform Configuration
# Interactive mode
robin-terraform fetch
# Fetch specific service
robin-terraform fetch gcp cloudrun
robin-terraform fetch gcp database
# Fetch SOC2 security layers
robin-terraform fetch gcp soc-layers/vpc
robin-terraform fetch gcp soc-layers/firewall
robin-terraform fetch gcp soc-layers/cloud-armorSpecify Target Directory
robin-terraform fetch gcp cloudrun --path ./infrastructure
robin-terraform fetch gcp soc-layers/vpc --path ./security/vpcForce 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 soc-layers/vpc variables.tfClean Up
# Remove terraform directory
robin-terraform clean
# Remove specific directory
robin-terraform clean --path ./infrastructureSOC2 Security Layers - Deployment Order
When deploying the SOC2 security layers, follow this order:
1️⃣ vpc → Base network (deploy first)
│
├── 2️⃣ private-service-connection → Enables Cloud SQL private IP
│
├── 2️⃣ vpc-connector → Connects Cloud Run to VPC
│
└── 2️⃣ firewall → Blocks dangerous ports
3️⃣ cloud-armor → Rate limiting (independent)Prerequisites for SOC2 Layers
Before deploying, assign this IAM role to your service account:
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="serviceAccount:SERVICE_ACCOUNT_EMAIL" \
--role="roles/resourcemanager.projectIamAdmin"Example: Full SOC2 Deployment
# 1. Deploy VPC
robin-terraform fetch gcp soc-layers/vpc --path ./1-vpc
cd 1-vpc && terraform init && terraform apply
VPC_ID=$(terraform output vpc_id)
cd ..
# 2. Deploy Private Service Connection
robin-terraform fetch gcp soc-layers/private-service-connection --path ./2-psc
cd 2-psc && terraform init && terraform apply
cd ..
# 3. Deploy VPC Connector
robin-terraform fetch gcp soc-layers/vpc-connector --path ./3-connector
cd 3-connector && terraform init && terraform apply
cd ..
# 4. Deploy Firewall Rules
robin-terraform fetch gcp soc-layers/firewall --path ./4-firewall
cd 4-firewall && terraform init && terraform apply
cd ..
# 5. Deploy Cloud Armor
robin-terraform fetch gcp soc-layers/cloud-armor --path ./5-armor
cd 5-armor && terraform init && terraform apply
cd ..Complete Workflow Example
Basic Service Deployment
# 1. Create project directory
mkdir my-api && cd my-api
# 2. Get Terraform config
robin-terraform fetch gcp cloudrun
# 3. Configure and deploy
cd terraform
# Edit variables.tf with your values
terraform init
terraform plan
terraform apply
# 4. Clean up when done
cd ..
robin-terraform cleanMulti-Service Deployment
# API service
robin-terraform fetch gcp cloudrun --path ./services/api
# Load Balancer
robin-terraform fetch gcp lb --path ./services/lb
# Database
robin-terraform fetch gcp database --path ./services/database
# Storage
robin-terraform fetch gcp bucket --path ./services/storageSecure Infrastructure Deployment
# 1. Security layers first
robin-terraform fetch gcp soc-layers/vpc --path ./infra/vpc
robin-terraform fetch gcp soc-layers/firewall --path ./infra/firewall
# 2. Database with private IP
robin-terraform fetch gcp soc-layers/private-service-connection --path ./infra/psc
robin-terraform fetch gcp database --path ./infra/database
# 3. Application with VPC connector
robin-terraform fetch gcp soc-layers/vpc-connector --path ./infra/connector
robin-terraform fetch gcp cloudrun --path ./infra/app
# 4. Protection layer
robin-terraform fetch gcp soc-layers/cloud-armor --path ./infra/armorCommand Reference
| 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] | List services (optional: specific provider) |
| show | <provider> <service> [file] | Preview configuration files |
| clean | --path, -p | Remove directory (default: ./terraform) |
Tips
- Always review
variables.tfafter fetching to set your project-specific values - Review
readme.txtin each module for IAM role requirements - Use
--pathflag to organize multiple terraform configurations - Run
terraform planbeforeapplyto review changes - Keep your terraform state files in a remote backend (GCS, S3) for team collaboration
- Deploy SOC2 layers in the correct order (VPC first)
Updating
# Check current version
robin-terraform --version
# Update to latest
npm update -g @androbinco/robin-terraformTroubleshooting
Version conflicts with pnpm
If you have version conflicts between npm and pnpm:
# Remove pnpm binary
rm $(which robin-terraform)
# Reinstall with npm
npm install -g @androbinco/robin-terraform@latestVerify installation path
which robin-terraform
robin-terraform --versionLicense
MIT
