Skip to content

GitHub organisation and repos management using Terraform Cloud

License

Notifications You must be signed in to change notification settings

delineateio/hashicorp-terraform-github

Repository files navigation

PRs Welcome Contributors Forks Stargazers Issues MIT License


delineate.io

delineate.io

portray or describe (something) precisely.

GitHub Terraform Management

This repo demonstrates using Hashicorp Terraform to manage a GitHub organisation and it's repositories.
Explore the docs »

Report Bug · Request Feature

Table of Contents

About The Project

This repo provides a Terraform configuration to manage a GitHub organisation. The solution uses Terraform Cloud as the centralised provisioning infrastructure to manage state and required secrets.

Built With

Further logos can be inserted to highlight the specific technologies used to create the solution from here.

Syntax Description
pre-commit Pre-commit git hooks that perform checks before pushes
GitHub Source control management platform
Docker Providing of a standardised local environment
Terraform GitHub provisioning configuration

Terraform Cloud Setup

A Terraform Cloud account will be required. In this example there are two workspaces defined, these workspaces are configured using Terraform remote backend files here.

alt text

Two env variables need to be configured in each Terraform Cloud workspace for GitHub

  • GITHUB_OWNER should be set to the organisation slug
  • GITHUB_TOKEN is the GitHub personal access token (PAT)

To create a new GitHub PAT then review the official documentation here.

Manage Repos

The repos to create and manage are defined in the auto.tfvars file here. The following attributes can be confirmed per repo.

name              = string
description       = string
homepage_url      = optional(string, "")
branch_protection = optional(bool, true)
default_branch    = optional(string, "main")
topics            = optional(list(string), [])
maintainers       = optional(list(string), [])
members           = optional(list(string), [])
visibility        = optional(string, "public")
archived          = optional(bool, false)
is_vercel_project = optional(bool, false)
is_template       = optional(bool, false)

GitHub Automation

For the exact configuration that runs review the organisation config and repo module. The following commands can be used:

# Test organisation plan and apply
task test:plan
task test:apply

# Prod organisation plan and apply
task prod:plan
task prod:apply

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

If you would like to contribute to any delineate.io OSS projects please read:

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

About

GitHub organisation and repos management using Terraform Cloud

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •