Skip to content

Commit 1a2eedb

Browse files
committed
Add documentation on how to provide the Gitlab token safely
1 parent 1c52c8d commit 1a2eedb

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

README.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,35 @@ By default the runner is registered on initial deployment. In previous versions
116116
To register the runner automatically set the variable `gitlab_runner_registration_config["registration_token"]`. This token value can be found in your GitLab project, group, or global settings. For a generic runner you can find the token in the admin section. By default the runner will be locked to the target project, not run untagged. Below is an example of the configuration map.
117117

118118
```hcl
119-
gitlab_runner_registration_config = {
120-
registration_token = "<registration token>"
121-
tag_list = "<your tags, comma separated>"
122-
description = "<some description>"
123-
locked_to_project = "true"
124-
run_untagged = "false"
125-
maximum_timeout = "3600"
126-
access_level = "<not_protected OR ref_protected, ref_protected runner will only run on pipelines triggered on protected branches. Defaults to not_protected>"
119+
module "gitlab_runner" {
120+
...
121+
122+
gitlab_runner_registration_config = {
123+
registration_token = aws_ssm_parameter.gitlab_runner_registration_token.value
124+
tag_list = "<your tags, comma separated>"
125+
description = "<some description>"
126+
locked_to_project = "true"
127+
run_untagged = "false"
128+
maximum_timeout = "3600"
129+
access_level = "<not_protected OR ref_protected, ref_protected runner will only run on pipelines triggered on protected branches. Defaults to not_protected>"
130+
}
127131
}
128-
```
132+
133+
# obtain this token from your Gitlab instance and store it manually in the SSM parameter
134+
135+
resource "aws_ssm_parameter" "gitlab_runner_registration_token" {
136+
name = "gitlab-registration-token"
137+
type = "SecureString"
138+
value = "Please fill manually."
139+
description = "Gitlab registration token for a new runner."
140+
141+
lifecycle {
142+
# the secret is set manually
143+
ignore_changes = [value]
144+
}
145+
}```
146+
147+
After deploying this infrastructure, fill in the token manually and kill the agents. After the automatic restart, all runners register automatically.
129148
130149
### Access runner instance
131150

0 commit comments

Comments
 (0)