terraform-aws-gitlab-runner
terraform-aws-gitlab-runner copied to clipboard
refactor!: remove manual registration of Gitlab Runner
Description
Removes the ability to register a Gitlab Runner manually (as described in #186) and pass the token into the module. This was done using secure_parameter_store_runner_token_key
It's now recommended to let the Gitlab Runner fetch the registration token from Gitlab and store it into a SSM parameter automatically.
If you use the secure_parameter_store_runner_token_key in the past: This SSM parameter is destroyed for every runner agent and a new one is created which is managed by the module. This means that new runners will register with Gitlab again.
Another way to get the token is the gitlabhq/gitlab provider. Check the data sources gitlab_group and gitlab_project. It does not work for instance runners as there is no data source available.
data "gitlab_group" "my_group" {
group_id = 4711
}
# data.gitlab_group.my_group.runners_token contains the token
Closes #186
Migrations required
- secure_parameter_store_runner_token_key
- clean up the runner list in Gitlab (Settings > CI/CD > Runners) as all Runners will register again.
Verification
Deployed the new version of the module into our production environment and ran some build jobs. Worked fine.
ToDo
- [ ] Update README.md and describe where to store the token
@kayman-mk need a bit more time for this PR. I am happy to drop this really old feature.
On my list!
@kayman-mk can you rebase this PR, will check this early next week. So I can release all breaking changes at once.
thx
No idea what happened here
@kayman-mk sorry for keep you waiting, quite busy.
rebased
Will dig in this PR soon, had quite some backlog.
Updated with develop branch.
@npalm Everything fixed.
@npalm What about this PR?
@npalm What about this PR?
Goinng to dig in.
@kayman-mk, maybe we could also suggest users to use the GitLab Terraform Provider to obtain their registration token?
- https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/data-sources/group#runners_token
- https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/data-sources/project#runners_token
Way I'm using the module right now:


This would not work however for instance runners since there is no API. Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/16319