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
29 changes: 28 additions & 1 deletion .github/workflows/opentofu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@ on:
description: Whether to setup SSH keys
type: boolean
default: false
aws-region:
description: AWS region for SOPS KMS access
type: string
default: us-west-2
aws-role-to-assume:
description: AWS IAM role to assume for SOPS KMS access
type: string
default: arn:aws:iam::332355796717:role/github-actions-sops-kms
secrets:
SOPS_AGE_KEY:
required: true
required: false
SSH_PRIVATE_KEY:
required: false
SSH_KNOWN_HOSTS:
required: false

permissions:
contents: read
id-token: write
pull-requests: write

jobs:
Expand All @@ -38,6 +47,12 @@ jobs:
with:
fetch-depth: 0

- name: Configure AWS credentials for SOPS KMS
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ inputs.aws-role-to-assume }}
aws-region: ${{ inputs.aws-region }}

- name: Install SSH key
if: ${{ inputs.setup-ssh }}
uses: shimataro/ssh-key-action@v2
Expand Down Expand Up @@ -66,6 +81,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials for SOPS KMS
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ inputs.aws-role-to-assume }}
aws-region: ${{ inputs.aws-region }}

- name: Install SSH key
if: ${{ inputs.setup-ssh }}
uses: shimataro/ssh-key-action@v2
Expand Down Expand Up @@ -115,6 +136,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials for SOPS KMS
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ inputs.aws-role-to-assume }}
aws-region: ${{ inputs.aws-region }}

- name: Install SSH key
if: ${{ inputs.setup-ssh }}
uses: shimataro/ssh-key-action@v2
Expand Down
11 changes: 8 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ Agents are authorized to push directly to `main` in this repository.
Reusable workflow for OpenTofu/Terraform root module repositories (`tfroot-*`). It:

1. Fetches the canonical pre-commit config from `makeitworkcloud/images`
2. Runs pre-commit on the `arc-tf` runner pod (which is itself the `tfroot-runner` image — no nested `container:` block)
3. Posts plan output as PR comments
4. Applies on merge to main
2. Assumes the SOPS KMS role through GitHub OIDC/WIF
3. Runs pre-commit on the `arc-tf` runner pod (which is itself the `tfroot-runner` image — no nested `container:` block)
4. Posts plan output as PR comments
5. Applies on merge to main

**Pre-commit configuration is centralized** in `makeitworkcloud/images/tfroot-runner/pre-commit-config.yaml`. Do not add `.pre-commit-config.yaml` to individual tfroot repos.

Expand All @@ -28,6 +29,10 @@ Reusable workflow for OpenTofu/Terraform root module repositories (`tfroot-*`).
| `runs-on` | `arc-tf` | Runner label — the in-cluster ARC scale set whose pods run the tfroot-runner image |
| `setup-ssh` | `false` | Provision an SSH key + known_hosts for libvirt-style root modules |
| `environment` | `production` | Environment for the apply job |
| `aws-region` | `us-west-2` | AWS region for SOPS KMS access |
| `aws-role-to-assume` | `arn:aws:iam::332355796717:role/github-actions-sops-kms` | IAM role assumed via GitHub OIDC for SOPS KMS decrypt/encrypt |

Caller workflows must grant `id-token: write` permissions for OIDC. `SOPS_AGE_KEY` is optional while SOPS files retain age recipients, but the preferred path is AWS KMS via OIDC.

There is no `container` input. The `arc-tf` runner pod IS the image, so adding `container:` on top would nest a container inside a container — don't do it.

Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:

permissions:
contents: read
id-token: write
pull-requests: write

jobs:
Expand All @@ -42,6 +43,8 @@ See [images](https://github.com/makeitworkcloud/images) for container source and

## Repository Setup

1. Add `SOPS_AGE_KEY` secret (via tfroot-github or manually)
2. Create caller workflow in `.github/workflows/`
3. Ensure repository has required files (e.g., `Makefile` with expected targets)
1. Grant `id-token: write` in the caller workflow so GitHub OIDC can assume the SOPS KMS role.
2. Optionally add `SOPS_AGE_KEY` secret as an age fallback while SOPS files retain age recipients.
3. Ensure the default `aws-role-to-assume` exists (`arn:aws:iam::332355796717:role/github-actions-sops-kms`) or pass another role ARN.
4. Create caller workflow in `.github/workflows/`.
5. Ensure repository has required files (e.g., `Makefile` with expected targets).
Loading