How infraweave-io/actions works
Project Type and Purpose
• This is an open‐source GitHub Actions toolkit.
• It provides ready‐to‐use workflows (test-module, publish-module, test-stack, publish-stack) that integrate Terraform, TFLint, Python tests, and Terraform‐related publishing.
• The consumers are any Terraform module or stack repository that adopts these workflows by referencing them in their own .github/workflows folder.
Core Components
A. Consumer Repository
• Holds Terraform definitions under src/ and tests under tests/.
• Defines workflow files in .github/workflows/ (e.g. test.yaml, publish-module.yaml).
B. GitHub Actions Runner
• GitHub‐hosted runner that executes jobs on ubuntu-latest.
C. InfraWeave Actions Repository
• The upstream actions definitions hosted at infraweave-io/actions/.github/workflows/...
• Versioned by commit SHA (e.g. @8ba76f33...).
D. Terraform & TFLint
• hashicorp/setup-terraform@v2 for Terraform CLI.
• TFLint installed via shell script.
E. Python Test Harness
• Finds and runs tests/*.py in parallel.
F. AWS Accounts & OIDC
• Uses GitHub’s OpenID Connect (id-token) to assume roles in Central and Workload accounts (via central_account_id and workload_account_id).
G. Artifact/Module Registry
• Terraform module registry (or custom registry) where modules/stacks are published.
Interactions and Data Flow
1. Developer pushes code (or manually dispatches) → triggers workflow in consumer repo.
2. Runner checks out code.
3. For testing modules:
• Runner sets up Terraform → runs TFLint → runs terraform init/validate.
• Then invokes the remote test-module.yaml action from InfraWeave.
• That action uses OIDC to get AWS credentials → runs Python tests.
4. For publishing modules or stacks:
• Runner dispatches remote publish-module.yaml or publish-stack.yaml.
• That action retrieves credentials via OIDC → packages & pushes artifacts to the registry.
Architectural Patterns & Design Principles
• Reusability: Core workflows are centralized in InfraWeave’s Actions repo and versioned.
• Separation of Concerns: Consumer repo only references workflows; all testing, linting, publishing logic lives upstream.
• Declarative Pipeline: Workflows define high-level jobs that call modular, parametrized actions.
• Secure Credentials via OIDC: No long‐lived secrets, just ephemeral AWS tokens.