This module handles the opinionated creation of infrastructure necessary to deploy Github Self Hosted Runners on MIG.
This includes:
- Enabling necessary APIs
- VPC
- NAT & Cloud Router
- Service Account for MIG
- MIG Instance Template
- MIG Instance Manager
- FW Rules
- Secret Manager Secret
Below are some examples:
This example shows how to deploy a MIG Self Hosted Runner bootstrapped using startup scripts.
This example shows how to deploy a MIG Self Hosted Runner with an image pre-baked using Packer.
Name | Description | Type | Default | Required |
---|---|---|---|---|
cooldown_period | The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. | number |
60 |
no |
create_network | When set to true, VPC,router and NAT will be auto created | bool |
true |
no |
create_subnetwork | Whether to create subnetwork or use the one provided via subnet_name | bool |
true |
no |
custom_metadata | User provided custom metadata | map(any) |
{} |
no |
gh_runner_labels | GitHub runner labels to attach to the runners. Docs: https://docs.github.com/en/actions/hosting-your-own-runners/using-labels-with-self-hosted-runners | set(string) |
[] |
no |
gh_token | Github token that is used for generating Self Hosted Runner Token | string |
n/a | yes |
instance_tags | Additional tags to add to the instances | list(string) |
[] |
no |
machine_type | The GCP machine type to deploy | string |
"n1-standard-1" |
no |
max_replicas | Maximum number of runner instances | number |
10 |
no |
min_replicas | Minimum number of runner instances | number |
2 |
no |
network_name | Name for the VPC network | string |
"gh-runner-network" |
no |
project_id | The project id to deploy Github Runner | string |
n/a | yes |
region | The GCP region to deploy instances into | string |
"us-east4" |
no |
repo_name | Name of the repo for the Github Action | string |
"" |
no |
repo_owner | Owner of the repo for the Github Action | string |
n/a | yes |
service_account | Service account email address | string |
"" |
no |
shutdown_script | User shutdown script to run when instances shutdown | string |
"" |
no |
source_image | Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image. | string |
"" |
no |
source_image_family | Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public Ubuntu image. | string |
"ubuntu-1804-lts" |
no |
source_image_project | Project where the source image comes from | string |
"ubuntu-os-cloud" |
no |
startup_script | User startup script to run when instances spin up | string |
"" |
no |
subnet_ip | IP range for the subnet | string |
"10.10.10.0/24" |
no |
subnet_name | Name for the subnet | string |
"gh-runner-subnet" |
no |
subnetwork_project | The ID of the project in which the subnetwork belongs. If it is not provided, the project_id is used. | string |
"" |
no |
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 |
network_name | Name of VPC |
service_account | Service account email for GCE |
subnet_name | Name of VPC |
Before this module can be used on a project, you must ensure that the following pre-requisites are fulfilled:
-
Required APIs are activated
"iam.googleapis.com", "compute.googleapis.com", "storage-component.googleapis.com", "logging.googleapis.com", "monitoring.googleapis.com", "secretmanager.googleapis.com",