A template repository for creating reusable Terraform components that are consumed by Atmos stacks. Each component is a self Terraform root module that gets referenced from your stacks repo through source pinning with versioned tags.
.
├── components/terraform/
│ └── <component-name>/
│ ├── main.tf # Resource definitions and module calls
│ ├── variables.tf # Input variable declarations
│ ├── outputs.tf # Output value declarations
│ ├── versions.tf # Terraform and provider version constraints
│ ├── provider.tf # Provider configuration
│ └── data.tf # Data source lookups
├── .github/workflows/
│ ├── terraform-validate.yaml # Runs fmt check and validate on PR
│ ├── pr-title-check.yaml # Enforces conventional commit PR titles
│ └── release-version.yaml # Semantic versioning on merge to main
├── .gitignore
└── .releaserc.json
- Each component live under
components/terraform/<component-name>/ - Stacks repos reference components from this repo using source pinning:
source: uri: github.com/<org>/<this-repo>.git//components/terraform/<component-name> version: v1.0.0
- When changes are merged to
main, semantic-release auto-creates a new version tag based on commit messages
- Use this repo as a GitHub template
- Remove the
sample-componentdirectory - Create your component under
components/terraform/<your-component>/with the standard files (main.tf,variables.tf,outputs.tf,versions.tf,provider.tf,data.tf) - Install pre-commit hooks if applicable
- Open a PR with a commit title (e.g.,
feat: Add s3 component) - On merge, a version tag is automatically created
mkdir -p components/terraform/<component-name>
touch components/terraform/<component-name>/{main,variables,outputs,versions,provider,data}.tfEvery component should include these baseline variables:
| Variable | Description |
|---|---|
aws_region |
AWS region for deployment |
environment |
Environment name (dev, staging, prod) |
tags |
Map of tags applied to all resources |
stage |
Atmos stage name for state management |
| Workflow | Trigger | Description |
|---|---|---|
terraform-validate.yaml |
PR to main |
Checks formatting and runs terraform validate on each component |
pr-title-check.yaml |
PR opened/edited | Validates PR title follows conventional commits (feat:, fix:, chore:, etc.) |
release-version.yaml |
Push to main |
Creates a semantic version tag via semantic-release |
- sample-component: A template to use as a reference when adding new components