Terraform-Provider-Gitlabci: Register GitLab CI Runners
Easy runner registration via terraform
I’m a huge fan of terraform, so when I needed to build out cloud
infrastructure for GitLab CI/CD it was the first thing I reached for. The
native terraform-provider-gitlab
was very useful, but left out one critical
detail: it was not possible to register a runner.
Ouch. 💢
This left a rather annoyingly awkward gap in my terraform configurations, as I’d need to provision a runner token outside of terraform. I messed around with this, coming up with a couple… interesting approaches, but ultimately I realized that the only proper solution to this (read: that wasn’t just a giant hack) would require writing a provider.
terraform-provider-gitlabci
Recently I’ve had some free time, so I cleaned it up a bit and published it.
A quick example
Documentation and the like can be found over at the terraform registry, but here’s a quick example with only a minimum of hand-wavey:
|
|
Note how, using both the gitlab
and gitlabci
providers we can now register
GitLab runners. The example shows us using a registration token obtained from
a project data source, but terraform-provider-gitlabci
doesn’t care if it’s
a project, group, or even instance registration token. Additionally, while
the gitlab
provider does require API access, the gitlabci
provider only
requires a valid registration token.
Enjoy!