Skip to content

Version 1.0.0 – Initial Public Release: Predict Terraform Defects with Confidence

Choose a tag to compare

@abdelhaouari abdelhaouari released this 06 Apr 18:28
· 21 commits to main since this release
fbfe6b6

📢 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 .tf files
  • ✅ 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.json keeps predictions per block per commit, used to compute historical metrics like num_defects_before

📋 How It Works

  1. Detect changed Terraform blocks using Git
  2. Extract metrics from code, Git history, and diffs
  3. Build feature vectors for ML models
  4. Run predictions with confidence scores
  5. Update defect history, generate report, and display summary

📊 Output Files

  • out/code_metrics.json
  • out/delta_metrics.json
  • out/process_metrics.json
  • out/defect_history.json
  • out/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 fmt run 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.