We've all seen it happen: a Pull Request introduces a harmless-looking aws_instance or switches an RDS instance class, passes all unit tests, gets merged on a Friday afternoon, and turns into a four-figure surprise on next month's AWS bill.
At the same time, keeping track of Dockerfile best practices, docker-compose.yml hardening, and accidental secret leaks usually means stitching together three or four separate CI linters—each posting its own noisy comment thread on every commit.
To solve both problems in a single step, I built InfraGuard FinOps & Security—a zero-config GitHub Action that runs natively on your GitHub Runner in under 10 seconds, audits only the files touched in the Pull Request, and maintains one clean, idempotent Markdown report.
Why Consolidate FinOps and IaC Security in the PR?
Most existing tools fall into two extremes:
- Heavyweight FinOps platforms that require external SaaS accounts, cloud IAM credentials, and per-seat monthly subscriptions.
- Single-purpose linters (one for Dockerfiles, one for Terraform, one for secrets) that flood your Pull Request with separate comment threads and duplicate alerts on every push.
InfraGuard takes a different approach:
- Zero external infrastructure: Runs 100% on the GitHub Actions runner (
node20) with zero telemetry. - PR-diff scoped: Only inspects files added or modified in the Pull Request—no noisy dumps across untouched legacy infrastructure.
- One self-updating comment: Uses a hidden HTML marker (
<!-- infraguard-report -->) to update the existing PR comment in place on new commits instead of spamming your team.
30-Second Setup (Free Tier — No Account or API Key Required)
Out of the box, the Free tier audits Dockerfile and docker-compose.yml changes for security and reproducibility issues (unpinned :latest tags, missing USER directives, missing HEALTHCHECK, missing CPU/RAM limits).
Create .github/workflows/infraguard.yml in your repository:
yaml name: InfraGuard FinOps & Security on: pull_request: permissions: contents: read pull-requests: write jobs: infraguard: runs-on: ubuntu-latest steps: - name: Run InfraGuard Audit uses: arthepitech/infraguard-finops-action@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} Every time a Pull Request modifies a container configuration, InfraGuard posts inline code annotations directly on the offending lines alongside a consolidated summary table. --- ## Catching AWS Terraform Cost Spikes & Secret Leaks (Pro) For teams managing AWS infrastructure with Terraform or wanting hard CI merge gates, adding a license key unlocks: * **AWS Terraform FinOps & Security Auditing:** Flags GPU instances, unscaled large EC2/RDS instances, unencrypted EBS/RDS volumes, oversized disks, and `gp2` to `gp3` migration opportunities—complete with estimated monthly USD cost impact right inside the PR. * **Secret Leak Detection:** Scans added PR lines for exposed AWS keys, OpenAI/Anthropic tokens, Stripe keys, and GitHub tokens with strict value masking. * **Custom Policy & CI Merge Blocking:** Configure `.infraguard.yml` to enforce monthly budget thresholds (`IG-FIN-001`), ignore specific rules/paths, and fail the CI check (`fail_on_error: 'true'`) before expensive or insecure infrastructure gets merged. - name: Run InfraGuard Audit (Pro) uses: arthepitech/infraguard-finops-action@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} license_key: ${{ secrets.INFRAGUARD_LICENSE_KEY }} fail_on_error: 'true' *(Need to silence a known false positive on a specific line? Inline suppressions like `# infraguard:ignore IG-DKR-001` work in both Free and Pro modes.)* --- ## What the Pull Request Report Looks Like Instead of digging through raw CI logs, reviewers get an immediate breakdown of severity counts, estimated monthly AWS cost impact, and actionable remediation steps: | Severity | Rule | File | Resource / Issue | Est. Monthly Cost | Remediation | | :--- | :--- | :--- | :--- | :--- | :--- | | Warning | `IG-DKR-001` | `Dockerfile:1` | Unpinned base image (`node:latest`) | — | Pin an explicit version tag or `@sha256` digest | | Error | `IG-TF-001` | `infra/main.tf:12` | `aws_instance.gpu` | ~$2,234/mo | Verify necessity; consider Spot, Savings Plans, or smaller instance | | Error | `IG-SEC-001` | `.env:3` | `AKIA************XYZ1` | — | Revoke key in IAM immediately and use OIDC / GitHub Secrets | --- ## Try It on Your Next Pull Request You can install **InfraGuard FinOps & Security** directly from the **[GitHub Marketplace](https://github.com/marketplace/actions/infraguard-finops-security)** or inspect the open-source MIT codebase on **[GitHub](https://github.com/arthepitech/infraguard-finops-action)**. If you have ideas for new Terraform cost rules or Docker checks, feel free to open an issue or PR!