This repository contains an example setup for managing GitHub resources using the Terraform GitHub provider. It is ideal for automating your GitHub configurations in a declarative manner.
- Terraform installed on your machine. Download here.
- A GitHub account. Sign up here if you don't have one; it's free.
- A personal access token (PAT) from GitHub with the necessary permissions. Generate one here.
-
Clone the Repository
git clone https://github.com/mixxor/terraform-github-provider-example.git cd terraform-github-provider-example
-
Initialize Terraform
Run the following command to initialize the Terraform project, which will download the necessary provider plugins:
terraform init
-
Configure Environment Variables
Set your GitHub token as an environment variable. Replace
your_github_token
with your actual GitHub token.export GITHUB_TOKEN="your_github_token"
-
Update Terraform Configuration
Edit the Terraform configuration file (e.g.,
main.tf
) to specify your GitHub organization or the resources you want to manage. -
Plan and Apply
Run a Terraform plan to see the changes that will be made:
terraform plan
Apply the changes:
terraform apply
Feel free to fork this repository and submit pull requests with improvements or open an issue if you find any bugs or have suggestions.