Analyze infrastructure cost changes with Infracost and submit them as Overmind Custom Signals for enhanced financial risk visibility - all in parallel with your terraform analysis.
Add cost analysis to your Overmind workflow in under 2 minutes. This action runs Infracost on your terraform plans and submits cost changes as "Cost" signals, giving you immediate financial context while terraform analysis runs in parallel.
- uses: overmindtech/cost-signals-action@v1
with:
overmind-api-key: ${{ secrets.OVM_API_KEY }}
infracost-api-key: ${{ secrets.INFRACOST_API_KEY }}
This GitHub Action enhances your Overmind change analysis by:
- Analyzing cost impact immediately when a PR is created/updated
- Submitting cost changes as Custom Signals to Overmind (in parallel with terraform analysis)
- Providing instant financial context on infrastructure changes (typically within 30 seconds)
- Enriching the PR comment with cost data alongside blast radius analysis
Unlike policy violations which are binary (pass/fail), cost signals provide quantitative feedback with graduated severity (-4 to +3) based on the magnitude of change. Cost changes appear as "Cost" signals in your PR analysis with severity based on percentage change.
- An Overmind account (sign up free)
- Overmind API key stored as
OVM_API_KEY
in your GitHub secrets - Infracost API key stored as
INFRACOST_API_KEY
(get one free) - Terraform repository with infrastructure code
- A GitHub Pull Request (Custom Signals are linked to PRs)
- bc for mathematical calculations (pre-installed on GitHub Actions runners)
- jq for JSON parsing (pre-installed on GitHub Actions runners)
- Add the action to your workflow (
.github/workflows/terraform.yml
):
name: Terraform Analysis with Cost
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
# Your existing terraform job continues unchanged
terraform:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: overmindtech/actions/install-cli@main
- uses: overmindtech/actions/submit-plan@main
with:
ovm-api-key: ${{ secrets.OVM_API_KEY }}
plan-json: ./tfplan.json
# NEW: Add cost analysis in parallel
cost-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform Plan
run: |
terraform init
terraform plan -out=tfplan
terraform show -json tfplan > tfplan.json
- uses: overmindtech/cost-signals-action@v1
with:
overmind-api-key: ${{ secrets.OVM_API_KEY }}
infracost-api-key: ${{ secrets.INFRACOST_API_KEY }}
terraform-plan-json: ./tfplan.json
- Push changes and watch the magic happen! Cost changes will appear in your PR comment within seconds.
Input | Description | Required | Default |
---|---|---|---|
overmind-api-key |
Your Overmind API key | ✅ Yes | - |
infracost-api-key |
Your Infracost API key | ❌ No | - |
terraform-plan-json |
Path to terraform plan JSON | ❌ No | Auto-detected |
threshold-percentage |
Percentage change to trigger warnings | ❌ No | 20 |
threshold-absolute |
Absolute dollar change to trigger warnings | ❌ No | 500 |
currency |
Currency for display (USD, EUR, GBP) | ❌ No | USD |
submit-on-decreases |
Submit signals for cost decreases | ❌ No | true |
fail-on-threshold |
Fail if cost exceeds thresholds | ❌ No | false |
infracost-version |
Version of Infracost to install | ❌ No | latest |
overmind-cli-version |
Version of Overmind CLI to install | ❌ No | latest |
- uses: overmindtech/cost-signals-action@v1
with:
overmind-api-key: ${{ secrets.OVM_API_KEY }}
infracost-api-key: ${{ secrets.INFRACOST_API_KEY }}
terraform-plan-json: './tfplan.json'
threshold-percentage: 10 # More sensitive to changes
submit-on-decreases: false # Only track increases
fail-on-threshold: true # Block PR on excessive cost
The action uses a graduated severity scale based on percentage change:
Change | Severity | Signal |
---|---|---|
>100% increase | -4 | Critical cost increase |
50-100% increase | -3 | High cost increase |
20-50% increase | -2 | Moderate cost increase |
5-20% increase | -1 | Minor cost increase |
<5% change | - | No signal (below threshold) |
5-20% decrease | +1 | Minor cost reduction |
20-50% decrease | +2 | Moderate cost reduction |
>50% decrease | +3 | Significant cost reduction |
graph LR
PR[Pull Request] --> GHA[GitHub Actions]
GHA --> C1[Cost Analysis - 30 seconds]
GHA --> T1[Terraform Analysis - 3 minutes]
C1 --> CS[Cost Signal]
T1 --> BR[Blast Radius]
CS --> OV[Overmind Platform]
BR --> OV
OV --> Comment[Enhanced PR Comment]
- PR triggers workflow - Both terraform and cost analysis start
- Infracost runs immediately - Analyzes terraform plan for cost changes
- Changes become signals - Cost delta submitted as Custom Signal with calculated severity
- Overmind aggregates - Cost signals appear alongside other risk indicators
- Progressive updates - PR comment updates as signals arrive
- Complete context - Final comment includes cost, policy, and blast radius info
Note: Cost signals provide quantitative context rather than binary pass/fail, helping reviewers understand the financial impact of changes.
Test cost analysis locally without submitting to Overmind:
# Run Infracost on your terraform plan
infracost breakdown --path tfplan.json
# View cost breakdown
infracost diff --path tfplan.json
To test the complete flow with signal submission:
# In a PR with terraform changes
export OVERMIND_API_KEY="your_api_key"
export INFRACOST_API_KEY="your_infracost_key"
# Run the action locally (requires act)
act -j cost-analysis --secret-file .env
This project is licensed under the MIT License - see the LICENSE file for details.
Policy signals are binary (violation/no violation) while cost signals are quantitative, showing the magnitude and direction of cost changes with graduated severity.
Changes under 5% are considered noise and no signal is submitted. Clean runs stay clean.
Yes! Set submit-on-decreases: false
to only submit signals for cost increases.
Cost estimates are powered by Infracost's comprehensive cloud pricing database. While estimates may vary from actual bills due to usage-based pricing, they provide reliable relative comparisons for change impact.
Yes! The action can analyze any terraform plan JSON, whether from local runs, Terraform Cloud, or other CI/CD systems.
This action does not collect, store, or process any personal data. The only data transmitted is cost analysis information to your configured Overmind instance and terraform plan data to Infracost for analysis. For more information, see Overmind's Privacy Policy and Infracost's Privacy Policy.
By using this action, you agree to the GitHub Terms of Service, Overmind's Terms of Service, and Infracost's Terms of Service.
- Support: Join our Discord community
- Security Issues: Email [email protected]
- General Inquiries: Contact us at [email protected]
Made with care by Overmind