🌱 EcoInfra CLI Reference
Sustainable Infrastructure Analysis
The EcoInfra CLI helps you analyze your Infrastructure-as-Code (IaC) plans and estimate the carbon footprint of your cloud deployments.
🚀 Installation
🔧 Build from Source
For the latest features and development:
npm install
npm run package
⚡ Getting Started
1 Generate Terraform JSON File
Choose one of the following options:
📋 For Plan Analysis (Future Changes)
terraform show -json plan.out > plan.json
🏗️ For State Analysis (Current Infrastructure)
2 Get Your API Token
Log in at eco-infra.com, go to your profile, and create an API key.
3 Run the CLI Analysis
Execute the EcoInfra CLI with your JSON file:
For Plan Analysis:
For State Analysis:
📝 Usage
Command Syntax
The tool automatically detects whether the file is a Terraform plan or state JSON and processes it accordingly.
Required Options
--token
Your EcoInfra API key
--project-name
A unique name for your project
--file
Path to Terraform JSON file (plan or state - auto-detected)
Optional Flags
--breakdown
Show detailed resource-by-resource emissions breakdown
--apply
Mark this run as an applied deployment
Legacy Options (Deprecated)
--plan-file
Use --file instead --state-file
Use --file instead 💡 Examples
Plan Analysis (Future Changes)
--project-name "Production Account" \
--file plan.json
Analyzes the carbon impact of planned infrastructure changes before applying them. File type is auto-detected.
State Analysis (Current Infrastructure)
--project-name "Production Account" \
--file state.json
Analyzes the carbon footprint of your currently deployed infrastructure. File type is auto-detected.
Detailed Breakdown
--project-name "Production Account" \
--file terraform.json \
--breakdown
Includes resource-by-resource emissions data for detailed analysis. Works with both plan and state files automatically.
🛠️ CI/CD Integration
Integrate EcoInfra into your continuous integration pipelines to automatically track the carbon impact of infrastructure changes.
GitHub Actions Example
uses: ecoinfra/ecoinfra-action@v1.1.2
with:
token: $
project-name: 'my-project'
plan-file: './terraform/plan.json'
💡 Pro Tip
Set up branch protection rules to require carbon impact analysis before merging infrastructure changes. This helps maintain awareness of environmental impact across your team.