infra-cost 1.2.0 โ 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +328 -25
- package/dist/cli/index.js +8207 -6941
- package/dist/index.js +8204 -6938
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -181,6 +181,211 @@ infra-cost free-tier --json # JSON output
|
|
|
181
181
|
|
|
182
182
|
---
|
|
183
183
|
|
|
184
|
+
#### `infra-cost annotate` - Cost Annotations for IaC Files (NEW in v1.3.0)
|
|
185
|
+
|
|
186
|
+
Add cost estimates directly in your Infrastructure as Code files - see costs during code review!
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# Annotate Terraform files
|
|
190
|
+
infra-cost annotate --path ./terraform/
|
|
191
|
+
|
|
192
|
+
# Before:
|
|
193
|
+
resource "aws_instance" "web" {
|
|
194
|
+
instance_type = "t3.xlarge"
|
|
195
|
+
ami = "ami-12345678"
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
# After:
|
|
199
|
+
# ๐ฐ infra-cost: $121.47/month | aws_instance @ us-east-1
|
|
200
|
+
# ๐ก Consider t3.large for 50% savings if CPU < 40% (saves $60.74/month)
|
|
201
|
+
# ๐ Last updated: 2026-01-30
|
|
202
|
+
resource "aws_instance" "web" {
|
|
203
|
+
instance_type = "t3.xlarge"
|
|
204
|
+
ami = "ami-12345678"
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Features:**
|
|
209
|
+
- ๐ **Terraform & CloudFormation support** - HCL and YAML annotations
|
|
210
|
+
- ๐ฐ **Monthly cost estimates** - see the cost of each resource
|
|
211
|
+
- ๐ก **Optimization suggestions** - inline recommendations for savings
|
|
212
|
+
- ๐ **Auto-update** - keep annotations fresh with --update flag
|
|
213
|
+
- ๐งน **Clean removal** - remove all annotations with --remove
|
|
214
|
+
- ๐ **Dry run** - preview changes before applying
|
|
215
|
+
|
|
216
|
+
**Commands:**
|
|
217
|
+
```bash
|
|
218
|
+
# Annotate all Terraform files in a directory
|
|
219
|
+
infra-cost annotate --path ./terraform/
|
|
220
|
+
|
|
221
|
+
# CloudFormation templates
|
|
222
|
+
infra-cost annotate --path ./cloudformation/ --format cloudformation
|
|
223
|
+
|
|
224
|
+
# Preview without modifying files
|
|
225
|
+
infra-cost annotate --path ./terraform/ --dry-run
|
|
226
|
+
|
|
227
|
+
# Update existing annotations
|
|
228
|
+
infra-cost annotate --path ./terraform/ --update
|
|
229
|
+
|
|
230
|
+
# Remove all cost annotations
|
|
231
|
+
infra-cost annotate --path ./terraform/ --remove
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Perfect for:**
|
|
235
|
+
- Code reviews with cost visibility
|
|
236
|
+
- DevOps engineers writing IaC
|
|
237
|
+
- Cost-aware development culture
|
|
238
|
+
- Pre-commit cost checks
|
|
239
|
+
- Documentation of infrastructure costs
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
#### `infra-cost history` - Git Cost History (NEW in v1.3.0)
|
|
244
|
+
|
|
245
|
+
Correlate cost changes with git commits - see which code changes impact costs!
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Show cost history with git correlation
|
|
249
|
+
infra-cost history --git
|
|
250
|
+
|
|
251
|
+
# Output:
|
|
252
|
+
# ๐ Cost History with Git Correlation
|
|
253
|
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
254
|
+
# Date Cost Change Commit
|
|
255
|
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
256
|
+
# 2026-01-28 $142.30 +$12.40 abc1234 Add GPU instances
|
|
257
|
+
# 2026-01-27 $129.90 +$45.20 def5678 Deploy new RDS
|
|
258
|
+
# 2026-01-26 $84.70 -$8.30 ghi9012 Cleanup unused EBS
|
|
259
|
+
# 2026-01-25 $93.00 +$3.10 jkl3456 Update Lambda memory
|
|
260
|
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
261
|
+
#
|
|
262
|
+
# ๐ Significant cost changes:
|
|
263
|
+
# โข +$45.20 on 2026-01-27: def5678 "Deploy new RDS for analytics"
|
|
264
|
+
# โข +$12.40 on 2026-01-28: abc1234 "Add GPU instances for ML"
|
|
265
|
+
|
|
266
|
+
# Analyze specific commit
|
|
267
|
+
infra-cost history --commit abc1234
|
|
268
|
+
|
|
269
|
+
# Who caused the most cost changes this month?
|
|
270
|
+
infra-cost blame --period month
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**Features:**
|
|
274
|
+
- ๐ **Cost-commit correlation** - see which commits changed costs
|
|
275
|
+
- ๐ค **Author attribution** - track cost impact by developer
|
|
276
|
+
- ๐ **Trend analysis** - understand cost evolution over time
|
|
277
|
+
- ๐ **Commit details** - deep dive into specific commits
|
|
278
|
+
- ๐ **Multiple formats** - text, JSON, markdown output
|
|
279
|
+
- โ ๏ธ **Significant change alerts** - highlight big cost impacts
|
|
280
|
+
|
|
281
|
+
**Commands:**
|
|
282
|
+
```bash
|
|
283
|
+
# Show cost history for the past week (default)
|
|
284
|
+
infra-cost history --git
|
|
285
|
+
|
|
286
|
+
# Show history for different periods
|
|
287
|
+
infra-cost history --period month
|
|
288
|
+
infra-cost history --period quarter
|
|
289
|
+
|
|
290
|
+
# Filter by author
|
|
291
|
+
infra-cost history --author john@example.com
|
|
292
|
+
|
|
293
|
+
# Analyze specific commit
|
|
294
|
+
infra-cost history --commit abc1234
|
|
295
|
+
|
|
296
|
+
# Blame analysis - who impacted costs most?
|
|
297
|
+
infra-cost blame --period month
|
|
298
|
+
|
|
299
|
+
# Export to JSON for analysis
|
|
300
|
+
infra-cost history --format json > cost-history.json
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Perfect for:**
|
|
304
|
+
- Engineering teams tracking cost accountability
|
|
305
|
+
- Understanding which features drive costs
|
|
306
|
+
- Cost-aware code reviews
|
|
307
|
+
- FinOps culture and awareness
|
|
308
|
+
- Retrospectives on cost trends
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
#### `infra-cost terraform` - Terraform Cost Preview (NEW in v1.4.0)
|
|
313
|
+
|
|
314
|
+
**Estimate infrastructure costs BEFORE deploying - shift-left cost management!**
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
# Generate terraform plan and estimate costs
|
|
318
|
+
terraform plan -out=tfplan
|
|
319
|
+
infra-cost terraform --plan tfplan
|
|
320
|
+
|
|
321
|
+
# Output:
|
|
322
|
+
# โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
|
|
323
|
+
# โ Terraform Cost Estimate โ
|
|
324
|
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
325
|
+
# โ Resources to CREATE: โ
|
|
326
|
+
# โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
327
|
+
# โ + aws_instance.web_server (t3.xlarge) โ
|
|
328
|
+
# โ โโโ Monthly: $121.47 | Hourly: $0.1664 โ
|
|
329
|
+
# โ + aws_db_instance.primary (db.r5.large, 100GB gp2) โ
|
|
330
|
+
# โ โโโ Monthly: $182.80 | Hourly: $0.25 โ
|
|
331
|
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
332
|
+
# โ Resources to MODIFY: โ
|
|
333
|
+
# โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
334
|
+
# โ ~ aws_instance.api_server โ
|
|
335
|
+
# โ โโโ t3.medium โ t3.large: +$30.37/month โ
|
|
336
|
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
337
|
+
# โ Resources to DESTROY: โ
|
|
338
|
+
# โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
339
|
+
# โ - aws_instance.old_server โ
|
|
340
|
+
# โ โโโ Savings: -$60.74/month โ
|
|
341
|
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
342
|
+
# โ SUMMARY โ
|
|
343
|
+
# โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
344
|
+
# โ Current Monthly Cost: $1,240.50 โ
|
|
345
|
+
# โ Estimated New Cost: $1,520.83 โ
|
|
346
|
+
# โ Difference: +$280.33/month (+22.6%) โ
|
|
347
|
+
# โ โ
|
|
348
|
+
# โ โ ๏ธ Cost increase exceeds 20% threshold! โ
|
|
349
|
+
# โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**Usage Examples:**
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
# Basic cost estimate
|
|
356
|
+
terraform plan -out=tfplan
|
|
357
|
+
infra-cost terraform --plan tfplan
|
|
358
|
+
|
|
359
|
+
# With cost threshold (fail if > 20% change)
|
|
360
|
+
infra-cost terraform --plan tfplan --threshold 20
|
|
361
|
+
|
|
362
|
+
# JSON format for automation
|
|
363
|
+
infra-cost terraform --plan tfplan --output json
|
|
364
|
+
|
|
365
|
+
# From JSON plan
|
|
366
|
+
terraform show -json tfplan > tfplan.json
|
|
367
|
+
infra-cost terraform --plan tfplan.json
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**Supported Resources:**
|
|
371
|
+
- โ
EC2 instances (all types)
|
|
372
|
+
- โ
RDS instances with storage
|
|
373
|
+
- โ
EBS volumes (gp2, gp3, io1, io2, st1, sc1)
|
|
374
|
+
- โ
Load Balancers (ALB, NLB, CLB)
|
|
375
|
+
- โ
NAT Gateways
|
|
376
|
+
- โ
ElastiCache clusters
|
|
377
|
+
- โ
S3 buckets (estimated)
|
|
378
|
+
- โ
Lambda functions (estimated)
|
|
379
|
+
|
|
380
|
+
**Perfect for:**
|
|
381
|
+
- CI/CD cost gates
|
|
382
|
+
- Preventing expensive deployments
|
|
383
|
+
- Cost-aware infrastructure changes
|
|
384
|
+
- Shift-left FinOps culture
|
|
385
|
+
- Pre-deployment cost reviews
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
184
389
|
### Command Migration Table
|
|
185
390
|
|
|
186
391
|
| Command Usage | Old Command (v0.x) | New Command (v1.0) |
|
|
@@ -511,15 +716,49 @@ infra-cost export inventory pdf
|
|
|
511
716
|
infra-cost cost analyze --output json
|
|
512
717
|
```
|
|
513
718
|
|
|
514
|
-
### Interactive Dashboard
|
|
719
|
+
### Interactive TUI Dashboard
|
|
720
|
+
|
|
721
|
+
**Real-time cost monitoring with keyboard navigation**
|
|
722
|
+
|
|
515
723
|
```bash
|
|
516
|
-
# Launch interactive
|
|
724
|
+
# Launch interactive TUI dashboard (shortcut)
|
|
725
|
+
infra-cost dashboard
|
|
726
|
+
|
|
727
|
+
# Or explicitly
|
|
517
728
|
infra-cost dashboard interactive
|
|
518
729
|
|
|
730
|
+
# Custom refresh interval (default: 60 seconds)
|
|
731
|
+
infra-cost dashboard --refresh 30
|
|
732
|
+
|
|
519
733
|
# Multi-cloud dashboard
|
|
520
734
|
infra-cost dashboard multicloud
|
|
521
735
|
```
|
|
522
736
|
|
|
737
|
+
**Features:**
|
|
738
|
+
- ๐จ Beautiful terminal UI with real-time updates
|
|
739
|
+
- โจ๏ธ Full keyboard navigation (vim-style supported)
|
|
740
|
+
- ๐ Multiple views: Services, Resources, Trends, Alerts
|
|
741
|
+
- ๐ Live trend indicators (โ up, โ down, โ stable)
|
|
742
|
+
- ๐ Real-time alert notifications
|
|
743
|
+
- ๐ Auto-refresh with configurable intervals
|
|
744
|
+
- ๐ฏ Drill-down into services and resources
|
|
745
|
+
|
|
746
|
+
**Keyboard Shortcuts:**
|
|
747
|
+
```
|
|
748
|
+
q - Quit
|
|
749
|
+
r - Refresh data
|
|
750
|
+
โโ/jk - Navigate rows
|
|
751
|
+
โโ/hl - Switch tabs
|
|
752
|
+
1-4 - Quick tab switch
|
|
753
|
+
? - Help
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
**Perfect for:**
|
|
757
|
+
- DevOps engineers monitoring costs in terminal
|
|
758
|
+
- SREs with terminal-based workflows
|
|
759
|
+
- Real-time cost exploration
|
|
760
|
+
- Server environments without GUI
|
|
761
|
+
|
|
523
762
|
## ๐ฌ Slack Integration
|
|
524
763
|
|
|
525
764
|
### Enhanced Team Collaboration
|
|
@@ -557,48 +796,71 @@ jobs:
|
|
|
557
796
|
--slack-channel ${{ secrets.SLACK_CHANNEL }}
|
|
558
797
|
```
|
|
559
798
|
|
|
560
|
-
## ๐ค GitHub Actions Integration
|
|
799
|
+
## ๐ค GitHub Actions Integration (v1.4.0+)
|
|
561
800
|
|
|
562
|
-
**infra-cost** is available as a GitHub Action
|
|
801
|
+
**infra-cost** is available as a GitHub Action, making it easy to integrate cost analysis into your CI/CD workflows with cost gates and automated PR comments.
|
|
563
802
|
|
|
564
|
-
###
|
|
803
|
+
### Quick Cost Check
|
|
565
804
|
```yaml
|
|
566
805
|
name: Cost Analysis
|
|
567
|
-
on: [
|
|
806
|
+
on: [pull_request]
|
|
568
807
|
|
|
569
808
|
jobs:
|
|
570
|
-
|
|
809
|
+
cost-check:
|
|
571
810
|
runs-on: ubuntu-latest
|
|
572
811
|
steps:
|
|
573
|
-
- uses:
|
|
812
|
+
- uses: actions/checkout@v4
|
|
813
|
+
- uses: codecollab-co/infra-cost@v1.4.0
|
|
574
814
|
with:
|
|
575
815
|
provider: aws
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
816
|
+
command: now
|
|
817
|
+
comment-on-pr: true
|
|
818
|
+
env:
|
|
819
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
579
820
|
```
|
|
580
821
|
|
|
581
|
-
###
|
|
822
|
+
### Cost Gate - Fail on Increase
|
|
582
823
|
```yaml
|
|
583
|
-
name:
|
|
584
|
-
on:
|
|
585
|
-
pull_request:
|
|
586
|
-
branches: [main]
|
|
824
|
+
name: Cost Gate
|
|
825
|
+
on: pull_request
|
|
587
826
|
|
|
588
827
|
jobs:
|
|
589
|
-
cost-
|
|
828
|
+
cost-gate:
|
|
590
829
|
runs-on: ubuntu-latest
|
|
591
|
-
permissions:
|
|
592
|
-
pull-requests: write
|
|
593
830
|
steps:
|
|
594
|
-
- uses:
|
|
831
|
+
- uses: actions/checkout@v4
|
|
832
|
+
- uses: codecollab-co/infra-cost@v1.4.0
|
|
595
833
|
with:
|
|
596
834
|
provider: aws
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
835
|
+
command: now
|
|
836
|
+
fail-on-increase: true # Fail if ANY cost increase
|
|
837
|
+
cost-threshold: 1000 # Fail if monthly cost exceeds $1000
|
|
838
|
+
comment-on-pr: true
|
|
839
|
+
env:
|
|
840
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
### Terraform Cost Preview (Shift-Left)
|
|
844
|
+
```yaml
|
|
845
|
+
name: Terraform Cost Check
|
|
846
|
+
on: pull_request
|
|
847
|
+
|
|
848
|
+
jobs:
|
|
849
|
+
terraform-cost:
|
|
850
|
+
runs-on: ubuntu-latest
|
|
851
|
+
steps:
|
|
852
|
+
- uses: actions/checkout@v4
|
|
853
|
+
|
|
854
|
+
- name: Terraform Plan
|
|
855
|
+
run: terraform plan -out=tfplan
|
|
856
|
+
|
|
857
|
+
- name: Cost Estimate
|
|
858
|
+
uses: codecollab-co/infra-cost@v1.4.0
|
|
859
|
+
with:
|
|
860
|
+
command: terraform
|
|
861
|
+
additional-args: '--plan tfplan --threshold 20'
|
|
862
|
+
env:
|
|
863
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
602
864
|
```
|
|
603
865
|
|
|
604
866
|
### Daily Cost Report to Slack
|
|
@@ -878,6 +1140,47 @@ src/
|
|
|
878
1140
|
- Approval workflows
|
|
879
1141
|
- Related: Issue #42 (Scheduled Reports), Issue #49 (API Server)
|
|
880
1142
|
|
|
1143
|
+
### Q2 2026 (v1.3.0 - Phase 2 Complete)
|
|
1144
|
+
|
|
1145
|
+
**Priority: Developer Experience & IDE Integration**
|
|
1146
|
+
- โ
**Interactive TUI Dashboard** (Issue #43)
|
|
1147
|
+
- React Ink-based terminal UI
|
|
1148
|
+
- Real-time cost monitoring with keyboard navigation
|
|
1149
|
+
- Multiple views: Services, Resources, Trends, Alerts
|
|
1150
|
+
- โ
**Cost Annotations for IaC Files** (Issue #54)
|
|
1151
|
+
- Terraform and CloudFormation cost comments
|
|
1152
|
+
- Inline optimization suggestions
|
|
1153
|
+
- Update/remove annotations
|
|
1154
|
+
- โ
**Git Cost History** (Issue #56)
|
|
1155
|
+
- Cost-commit correlation
|
|
1156
|
+
- Blame analysis by author
|
|
1157
|
+
- Historical trend analysis
|
|
1158
|
+
- ๐ฎ **VS Code Extension** (Issue #55 - Planned)
|
|
1159
|
+
- Inline cost display for Terraform/CloudFormation
|
|
1160
|
+
- Sidebar panel with cost summaries
|
|
1161
|
+
- CodeLens integration
|
|
1162
|
+
- Hover information with alternatives
|
|
1163
|
+
- **Note:** VS Code extension will be a separate repository
|
|
1164
|
+
- Integration points with CLI for cost data
|
|
1165
|
+
|
|
1166
|
+
### Q2 2026 (v1.4.0 - Phase 3: CI/CD & Shift-Left)
|
|
1167
|
+
|
|
1168
|
+
**Priority: CI/CD Integration & Shift-Left Cost Management**
|
|
1169
|
+
- โ
**GitHub Actions Integration** (Issue #46)
|
|
1170
|
+
- Native GitHub Action for cost analysis in PRs
|
|
1171
|
+
- Cost gates with fail-on-increase and threshold checks
|
|
1172
|
+
- Enhanced PR comments with cost breakdown
|
|
1173
|
+
- Multiple output variables for downstream jobs
|
|
1174
|
+
- Slack notification support
|
|
1175
|
+
- โ
**Terraform Cost Preview** (Issue #47)
|
|
1176
|
+
- Parse terraform plan files (binary and JSON)
|
|
1177
|
+
- Estimate costs before deployment
|
|
1178
|
+
- Show create/modify/destroy breakdown
|
|
1179
|
+
- Cost threshold gates for CI/CD
|
|
1180
|
+
- Support for EC2, RDS, EBS, Load Balancers, and more
|
|
1181
|
+
- Monthly and hourly cost estimates
|
|
1182
|
+
- Shift-left cost management
|
|
1183
|
+
|
|
881
1184
|
### Q3 2026 (Planned)
|
|
882
1185
|
|
|
883
1186
|
**Priority: Enterprise Features**
|