$ show dflook/terraform-github-actions
This repository provides a comprehensive suite of GitHub Actions for automating Terraform and OpenTofu workflows in CI/CD pipelines. Each action (e.g., terraform-apply, terraform-plan, terraform-validate) is implemented as a standalone reusable workflow with standardized inputs, outputs, and Docker-based execution environments. The architecture features a common shell library (actions.sh) that handles tool installation, backend initialization, and shared utilities, while individual actions focus on specific operations like plan generation, state management, or pull request commenting. Key capabilities include version detection from multiple sources, backend fingerprinting for state identification, automated PR commenting with approval workflows, and support for both Terraform and OpenTofu. The project emphasizes reliability through extensive testing across versions and backends, with clear separation of concerns between action definitions, implementation logic, and documentation generation.
The LLM identified 4 files worth highlighting for reuse:
Implements robust version detection for Terraform/OpenTofu by checking multiple sources (.tf files, .tool-versions, Terraform Cloud, environment variables) and enforcing backend-specific version constraints. Demonstrates non-obvious skill in handling complex version resolution logic while remaining isolated from other components.
Generates unique identifiers for Terraform backend configurations by hashing backend properties. Supports 15+ backend types (local, S3, GCS, Azurerm, etc.) and enables accurate matching of GitHub comments to infrastructure states. The module is self-contained with clear separation of concerns and reusable in any state-tracking context.
Provides a common library of functions (debug, setup, init-backend-workspace) sourced by all action entrypoints. Eliminates duplication across 30+ actions while handling tool installation, authentication, and backend initialization. The library's design allows extraction to other shell-based projects with minimal modification.
Automates generation of action metadata (action.yaml) and documentation (README.md) from Python definitions. Ensures consistency across all actions by defining inputs/outputs once and reducing maintenance burden. The system demonstrates advanced metaprogramming while remaining loosely coupled from action implementations.