This example showcases how to use startup scripts to deploy runners using the gh-runner-mig
module.
We use startup/shutdown scripts to install the runner binary, register the runner when it comes online and de-register when shut down.
- Step 1: Create terraform.tfvars file with the necessary values.
Access tokens require repo scope for private repos and public_repo scope for public repos. GitHub Apps must have the administration permission to use this API. Authenticated users must have admin access to the repository to use this API.
More info can be found here.
project_id = "your-project-id"
gh_token = "your-github-token"
repo_name = "your-repo-name"
repo_owner = "owner"
- Step 2: Create the infrastructure
$ terraform init
$ terraform plan
$ terraform apply
- Step 3: Your runners should become active at https://github.com/owner/your-repo-name/settings/actions.
Name | Description | Type | Default | Required |
---|---|---|---|---|
gh_token | Github token that is used for generating Self Hosted Runner Token | string |
n/a | yes |
project_id | The project id to deploy Github Runner MIG | string |
n/a | yes |
repo_name | Name of the repo for the Github Action | string |
n/a | yes |
repo_owner | Owner of the repo for the Github Action | string |
n/a | yes |
Name | Description |
---|---|
mig_instance_group | The instance group url of the created MIG |
mig_instance_template | The name of the MIG Instance Template |
mig_name | The name of the MIG |
service_account | Service account email for GCE |