Skip to main content

using terraform for GitHub

I probably recommend most organizations with more than one engineer (and more than one repo) leverage terraform to manage GitHub. I have two primary reasons:

  1. It standardizes GitHub. Enabling describing repositories as code, and creating a module with common settings, establishes the pattern for how code is stored.

  2. It democratizes administration. In an organizational account, someone is an administrator. This person is responsible for all the administrative actions in GitHub, whatever they may be. In any small organization, this is likely too much overhead, and in any large one, it is likely too much of a bottleneck. Providing workflow access to execute administrative behaviors via terraform makes it so that there's an audit log, and reversibility.

Theoretically, in a small organization, the other alternative is to just 'open it up' and allow everyone to do everything. There are some pros to this approach, but I think that the lack of standardization is a cost worth considering, as well as the lack of visibility. The audit log provides the benefit of providing visibility to everyone to what even one person is doing, so that if it needs to be redone or undone, there's clarity into what needs to be done, and often times, it also provides a means to answer how something works or why it does not.

I use terraform for managing my personal GitHub. This provides me with a means to make changes to GitHub without leaving my code editor, mostly--which is what I care about. My measure of productivity is aligned with 'how much time can I spend directly in my code editor when working'. My mean time to resolution on a sticky issue is often directly related to how long it takes me to find the code or commands that caused the issue, determine the appropriate reversal, and apply it. Code is easier for me to undo than commands because code is less ephemeral.

My GitHub terraform repo is private, but there are lots of examples on the internet. If you're reading this and want some support migrating a GitHub organization to terraform, e-mail me at thatrandybrown@gmail.com.