Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ jobs:

- name: Conventional commit check
uses: cocogitto/cocogitto-action@v4
with:
command: check
65 changes: 65 additions & 0 deletions .github/workflows/terragrunt_apply.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: Terragrunt Apply

on:
push:
branches:
- main
paths:
- "github/**"
- ".github/workflows/terragrunt_apply.yml"

jobs:
terragrunt_apply:
runs-on: ubuntu-latest
name: Run Terragrunt Apply for GitHub Directory
permissions:
contents: read
issues: write

steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Setup OpenTofu
uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.8.1

- name: Setup Terragrunt
run: |
wget https://github.com/gruntwork-io/terragrunt/releases/download/v0.67.16/terragrunt_linux_amd64
chmod +x terragrunt_linux_amd64
sudo mv terragrunt_linux_amd64 /usr/local/bin/terragrunt
terragrunt --version

- name: Configure MinIO credentials (for S3 backend)
env:
AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_SECRET_ACCESS_KEY }}
run: |
echo "MinIO credentials configured"

- name: Run Terragrunt Apply
working-directory: ./github
env:
AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.TERRAGRUNT_GITHUB_API_TOKEN }}
run: |
terragrunt run-all apply --terragrunt-non-interactive

- name: Create Issue on Failure
if: failure()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Terragrunt Apply Failed - ${context.sha.substring(0, 7)}`,
body: `❌ Terragrunt apply failed for commit ${context.sha}\n\nWorkflow run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}\n\nPlease check the logs for details.`,
labels: ['terragrunt', 'deployment-failure']
})
5 changes: 5 additions & 0 deletions .github/workflows/terragrunt_plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
terragrunt_plan:
runs-on: ubuntu-latest
name: Run Terragrunt Plan for GitHub Directory
permissions:
contents: read
pull-requests: write
issues: write

steps:
- name: Checkout code
Expand Down Expand Up @@ -43,6 +47,7 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_SECRET_ACCESS_KEY }}
GITHUB_TOKEN: ${{ secrets.TERRAGRUNT_GITHUB_API_TOKEN }}
run: |
terragrunt run-all plan --terragrunt-non-interactive

Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.96.1
rev: v1.103.0
hooks:
- id: terragrunt_fmt
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
Expand Down
4 changes: 2 additions & 2 deletions github/terraform-gh-modules/repos/dotgithub/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ terraform {
source = "tfr:///mineiros-io/repository/github?version=0.18.0"
}

include {
path = find_in_parent_folders()
include "root" {
path = find_in_parent_folders("root.hcl")
}

# Indicate what region to deploy the resources into
Expand Down
35 changes: 35 additions & 0 deletions github/unicornops/repos/family-chat/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
terraform {
source = "tfr:///mineiros-io/repository/github?version=0.18.0"
}

include "root" {
path = find_in_parent_folders("root.hcl")
}

# Indicate what region to deploy the resources into
generate "provider" {
path = "provider.tf"
if_exists = "overwrite_terragrunt"
contents = <<EOF
provider "github" {
owner = "${local.org_vars.github_owner}"
}
terraform {
backend "s3" {}
}
EOF
}

locals {
org_vars = yamldecode(file(find_in_parent_folders("org.yaml")))
repo_name = basename(get_terragrunt_dir())
}

inputs = {
name = local.repo_name
vulnerability_alerts = true
visibility = "private"
description = "Repo for the family chat project"
has_issues = true
has_wiki = true
}