Yesterday I've completed the migration to git-repo-mgmt. It's an OpenTofu based management of my git repositories at Sourcehut with mirrors at Codeberg, Gitlab and GitHub.
I was tired to manually create repos across four platforms. Now it takes me seconds and a couple lines of code to do it, for example:
# SPDX-FileCopyrightText: 2024 Dominik Wombacher <dominik@wombacher.cc>
#
# SPDX-License-Identifier: MIT
module "git-repo-mgmt" {
source = "./modules/repos"
repo_name = "git-repo-mgmt"
description = "OpenTofu based management of my git repositories"
}
The heart of the solution is a self written OpenTofu / Terraform module that does all the heavy lifting. It uses the sourcehut OpenTofu / Terraform provider that I recently publish and leverages AWS KMS for OpenTofu State and Plan Encryption.
On every push, builds.sr.ht is triggered and runs the mirror, setup, init, plan
and apply phases as defined in .build.yml
The overall workflow looks like this:
git push
> git.sr.ht
> builds.sr.ht
> tofu apply
> sr.ht
> codeberg.org
> github.com
> gitlab.com
I'm very satisfied with the result, this makes things so much easier.