Repository navigation
Version 1.0.0 – Initial Public Release: Predict Terraform Defects with Confidence
📢 Initial Public Release of TFDefectGA (v1.1.0)
TFDefectGA is a complete solution for analyzing Terraform code, extracting metrics, and predicting potential defects using Machine Learning – all integrated into a GitHub Action and fully Dockerized.
This release includes everything you need to automatically assess Terraform files during CI/CD pipelines or from local runs.
🧠 Core Capabilities
- ✅ Terraform block analysis from
.tffiles - ✅ Extraction of 3 types of metrics:
- 📦 Code metrics (e.g., complexity, duplication via TerraMetrics)
- 🔁 Delta metrics (before/after changes between commits)
- 🧑💻 Process metrics (Git history, number of authors, time intervals, etc.)
- ✅ Change detection at the block level via Git diff
- ✅ Modular metric extractors (codemetrics, delta, process)
- ✅ Historical tracking of predictions in
defect_history.json - ✅ Beautiful HTML reports with prediction results per block
🤖 Machine Learning & Prediction
- 🧠 Built-in ML model support (e.g.
DummyModel,RandomForestClassifier) - 🧪 Models predict whether a Terraform block is
fault_prone(0 = Clean, 1 = Defective) - 📊 Confidence score included using
predict_proba()(e.g.,Confidence Score: 0.76) - 📈
defect_history.jsonkeeps predictions per block per commit, used to compute historical metrics likenum_defects_before
📋 How It Works
- Detect changed Terraform blocks using Git
- Extract metrics from code, Git history, and diffs
- Build feature vectors for ML models
- Run predictions with confidence scores
- Update defect history, generate report, and display summary
📊 Output Files
out/code_metrics.jsonout/delta_metrics.jsonout/process_metrics.jsonout/defect_history.jsonout/reports/report_<timestamp>.html
📌 What's New in This Version
- ✅ Full pipeline from metrics -> predictions -> reporting
- ✅ Docker support + Terraform installed
- ✅ Confidence scores in console + reports
- ✅ Dynamic feature count shown in model description
- ✅
terraform fmtrun before analysis - ✅ Complete documentation in
README.md
Thanks for checking out TFDefectGA! 💙
Stay tuned for upcoming features like real-time alerting, more ML models, and advanced visualization.