Skip to content

Conversation

@SIMVIA-lucas-sovre
Copy link

Your checklist for this pull request

Description

Added a new tutorial showing how to dynamically create and destroy GitLab runners on Scaleway instances using Terraform. This tutorial provides a cost-effective solution for teams needing high-computation runners on-demand.

Key features covered:

  • Setting up Terraform configuration with Scaleway and GitLab providers
  • Creating cloud-init scripts for automatic GitLab runner registration
  • Implementing a complete GitLab CI/CD pipeline that provisions runners, executes jobs, and cleans up resources
  • Using custom instance images for specialized use cases

Target audience: DevOps engineers and developers looking to optimize CI/CD costs by provisioning runners only when needed.

linked to the #4969 issue

Co-authored-by: Jessica <[email protected]>
Co-authored-by: Néda <[email protected]>
Co-authored-by: Benedikt Rollik <[email protected]>
Copy link
Author

@SIMVIA-lucas-sovre SIMVIA-lucas-sovre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have review all suggestions, and added almost all suggestions. Wait for the final PR validation, thanks for your help !

@SIMVIA-lucas-sovre
Copy link
Author

@ofranc do you know when will this be merged ? or does i need to do any thing ?

@SamyOubouaziz
Copy link
Collaborator

Hello @SIMVIA-lucas-sovre, Sorry for the late reply! I just tested (without success), some parts of the tutorial are unclear:

  • where should I create the TF and look.bash files ? at the root of the GitLab Project ?
  • What to do once I created all the files to trigger the pipeline ?


Start by providing a basic Terraform/OpenTofu setup:

1. Create a `main.tf` file and paste the following content into it:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at which location ? at the root of the project ?

- SCW_ACCES_KEY

The `GITLAB_TOKEN` needs to be a GitLab personal access token with the **Owner** role, and `create_runner` scope.
Create the environment variables in your [project CI/CD settings](https://docs.gitlab.com/ci/variables/)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please Specify that it's in the project, under Settings > CI/CD > Variables

fi
done
```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If required, add a step to describe what to do to trigger the pipeline, and how to see the logs of the jobs to check if everything works fine. Thanks!

@SamyOubouaziz
Copy link
Collaborator

Also, another technical writer tested it before, and got the error below

╷
│ Error: Error creating new GitLab Runner
│
│   with gitlab_user_runner.project_runner,
│   on main.tf line 50, in resource "gitlab_user_runner" "project_runner":
│   50:         resource "gitlab_user_runner" "project_runner" {
│
│ couldn't create new GitLab Runner: POST https://gitlab.com/api/v4/user/runners: 400 {message: 400 Bad
│ request - Tags list can not be empty when runner is not allowed to pick untagged jobs}

Could you check if you can reproduce and fix accordingly if there is an issue with your code?

Thank you very much !

@ofranc ofranc closed this Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants