A Terraform and Terragrunt powered solution for managing GitHub repositories as code!
This project uses Infrastructure as Code (IaC) principles to automate the creation and management of GitHub repositories. Instead of clicking around in the GitHub UI, you define your repositories in code and let automation do the rest!
- Repository Management: Create, configure, and manage GitHub repositories
- Branch Protection: Define branch protection rules and rulesets
- Organization Settings: Manage organization-wide defaults
- Secure Credentials: Uses AWS SSM Parameter Store for secure token management
- Terraform (v1.0+)
- Terragrunt (latest)
- AWS CLI configured with appropriate permissions
- GitHub Personal Access Token (stored in AWS SSM Parameter Store)
-
Clone the repository:
git clone https://github.com/rstuhlmuller/github-iac.git cd github-iac -
Store your GitHub Personal Access Token in AWS SSM Parameter Store:
aws ssm put-parameter --name "/github-iac/personal_access_token" --value "your-github-token" --type SecureString
-
Navigate to your organization directory and run:
cd rstuhlmuller/github terragrunt plan terragrunt apply
modules/: Terraform modules for GitHub resourcesrstuhlmuller/: Organization-specific configurationscommon/: Shared providers and configurations
To add a new repository, update the github_repositories input in your organization's terragrunt.hcl file:
inputs = {
github_repositories = {
my-new-repo = {
description = "My awesome new repository"
visibility = "public"
}
}
}This project includes a devcontainer configuration with all necessary tools pre-installed:
- Terraform
- Terragrunt
- AWS CLI
- GitHub CLI
- VS Code extensions for HashiCorp configuration languages
MIT License - See LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Happy automating! 🤖