Skip to content

Terraform CI using GitHub Actions reusable workflows with directory-based change detection, linting, and security scans.

License

Notifications You must be signed in to change notification settings

joaodll/gha-devsecops-workflows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Terraform CI with GitHub Actions

A simple Terraform CI setup using GitHub Actions reusable workflows.

This repo is designed for Terraform monorepos and focuses on:

  • detecting only the Terraform directories that changed
  • running lint and security scans in parallel
  • keeping security checks non-blocking when desired

What this does

  • 🔍 Detects changed .tf files in pull requests
  • 📂 Builds a matrix of affected Terraform directories
  • 🧹 Runs lint checks per directory
  • 🔐 Runs security scans per directory
  • 🔁 Uses a reusable workflow to avoid duplication

📂 Structure

.github/workflows/
├── tf-dirs-matrix.yml   # Reusable workflow: detect changed Terraform dirs
└── tf-ci.yml            # CI workflow: lint + security scans

🔄 How it works

Pull Request
   ↓
Detect Terraform changes (reusable workflow)
   ↓
Matrix per directory
   ├─ Terraform lint (required)
   └─ Security scan (advisory)

Each job runs independently, so a failure in one does not stop the others.


Why this design

  • Reusable workflows keep logic in one place
  • Matrix jobs scale well in monorepos
  • Separate jobs give better feedback and flexibility
  • Non-blocking security surfaces issues without slowing development

📚 Documentation & Resources

About

Terraform CI using GitHub Actions reusable workflows with directory-based change detection, linting, and security scans.

Topics

Resources

License

Stars

Watchers

Forks

Contributors