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

Releases

No releases published

Packages

No packages published