This repository contains Terraform modules for managing GitHub resources, including organization settings, repositories, teams, and team memberships. It is designed to simplify and automate the management of your GitHub organization using Infrastructure as Code (IaC).
- Organization Management: Configure organization-level projects and webhooks.
- Repository Management: Create, manage, and customize GitHub repositories.
- Team Management: Define teams, set privacy levels, and manage team memberships.
- Scalable Design: Modular structure allows you to use individual components or the entire module.
terraform-github-management/
├── modules/
│ ├── organization/ # Organization-related resources
│ ├── repositories/ # Repository-related resources
│ └── teams/ # Team-related resources
├── examples/ # Example usage of each module
│ ├── organization-settings/
│ ├── repositories/
│ └── teams/
├── README.md # This documentation
├── LICENSE # Licensing information
├── versions.tf # Required Terraform and provider versions
-
Terraform: Ensure you have Terraform version
~> 1.9.0
installed.terraform --version
-
GitHub Provider: Install the Terraform GitHub provider.
-
Authentication: Export your GitHub personal access token with the required permissions:
export GITHUB_TOKEN="your_github_personal_access_token"
Required scopes:
read:org
repo
admin:org
The organization
submodule allows you to manage the settings of your GitHub organization.
It configures details such as the organization name, description, billing email, and social media links.
Name | Type | Description |
---|---|---|
organization_name |
string |
The name of the GitHub organization. |
company_name |
string |
The name of the company associated with the organization. |
organization_description |
string |
A description of the organization. |
billing_email |
string |
The billing email address for the organization. |
blog |
string |
URL to the organization's blog or website. |
twitter_user |
string |
The Twitter username for the organization or company. |
module "organization" {
source = "./modules/organization"
organization_name = "My GitHub Organization"
company_name = "My Company"
organization_description = "A GitHub organization for managing projects"
billing_email = "billing@mycompany.com"
blog = "https://mycompany.com/blog"
twitter_user = "mycompany"
}
output "organization_id" {
value = module.organization.organization_id
}
-
Validate Configuration:
terraform validate
-
Plan Changes:
terraform plan
-
Apply Changes:
terraform apply
-
Automated Tests: Use
terratest
or similar frameworks for integration tests.
This project is licensed under the MIT License. See the LICENSE file for details.
We welcome contributions! Please fork the repository, create a feature branch, and submit a pull request.
This module is maintained by Endalkachew Biruk.