Skip to content

rstuhlmuller/github-iac

Repository files navigation

GitHub Infrastructure as Code 🚀

A Terraform and Terragrunt powered solution for managing GitHub repositories as code!

What is this? 🤔

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!

Features ✨

  • 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

Getting Started 🚀

Prerequisites

  • Terraform (v1.0+)
  • Terragrunt (latest)
  • AWS CLI configured with appropriate permissions
  • GitHub Personal Access Token (stored in AWS SSM Parameter Store)

Setup

  1. Clone the repository:

    git clone https://github.com/rstuhlmuller/github-iac.git
    cd github-iac
  2. 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
  3. Navigate to your organization directory and run:

    cd rstuhlmuller/github
    terragrunt plan
    terragrunt apply

Project Structure 📂

  • modules/: Terraform modules for GitHub resources
  • rstuhlmuller/: Organization-specific configurations
  • common/: Shared providers and configurations

Adding New Repositories 🏗️

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"
    }
  }
}

Development Environment 🧰

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

License 📜

MIT License - See LICENSE for details.

Contributions 👥

Contributions are welcome! Please feel free to submit a Pull Request.


Happy automating! 🤖

About

Infrastructure as Code for Github Repositories

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages