This module deploys a virtual machine scale set for self hosted runners for Azure DevOps and GitHub.
provider "azurerm" {
features {}
}
module "vmss" {
source = "amestofortytwo/selfhostedrunnervmss/azurerm"
operating_system = "ubuntu" # windows or ubuntu
runner_platform = "azure_devops" # azure_devops or github
}
After deploying the virtual machine scale set, you need to configure the Azure DevOps or GitHub side of things according to our documentation:
No requirements.
provider "azurerm" {
features {}
}
module "vmss" {
source = "amestofortytwo/selfhostedrunnervmss/azurerm"
operating_system = "ubuntu" # windows or ubuntu
runner_platform = "azure_devops" # azure_devops or github
deploy_load_balancer = true
}
output "password" {
value = nonsensitive(module.vmss.password)
}
provider "azurerm" {
features {}
}
# Create custom rg
resource "azurerm_resource_group" "rg" {
location = "westeurope"
name = "runners"
}
# Create custom vnet
resource "azurerm_virtual_network" "vmss" {
name = "runner-network"
address_space = ["10.0.0.0/24"]
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}
resource "azurerm_subnet" "vmss" {
name = "vmss"
resource_group_name = azurerm_resource_group.rg.name
virtual_network_name = azurerm_virtual_network.vmss.name
address_prefixes = azurerm_virtual_network.vmss.address_space
}
module "vmss" {
source = "amestofortytwo/selfhostedrunnervmss/azurerm"
operating_system = "ubuntu" # windows or ubuntu
runner_platform = "azure_devops" # azure_devops or github
resource_group_name = azurerm_resource_group.rg.name
use_existing_resource_group = true
location = azurerm_resource_group.rg.location
virtual_machine_scale_set_name = "runners"
sku = "Standard_D2s_v3"
ssh_public_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADA....QFv2PJ0= marius@42device"]
subnet_id = azurerm_subnet.vmss.id
use_custom_subnet = true
vmss_encryption_at_host_enabled = true
}
output "password" {
value = nonsensitive(module.vmss.password)
}
Name | Version |
---|---|
azurerm | n/a |
random | n/a |
No modules.
Name | Description | Type | Default | Required |
---|---|---|---|---|
deploy_load_balancer | (Optional) When using the built-in network (use_custom_subnet is false), should we create a NAT gateway? This will be required in the future. Defaults to false. | bool |
false |
no |
enable_accelerated_networking | (Optional) Does this Network Interface support Accelerated Networking? Possible values are true and false. Defaults to false. | bool |
false |
no |
enable_automatic_instance_repair | Enable automatic instance repair for the VMSS. This will automatically repair instances that fail health checks. | bool |
false |
no |
enable_termination_notifications | Enable termination notifications for the VMSS. This will send a notification to the Azure Instance Metadata Service (IMDS) when the VMSS is scheduled for maintenance or when the VMSS is deleted. | bool |
false |
no |
load_balancer_backend_address_pool_id | (Optional) Value of the backend address pool id to use for the load balancer. I.e. for static outbound NAT. | string |
"" |
no |
location | The Azure region to create the scale set in | string |
"westeurope" |
no |
operating_system | The OS of the runners | string |
"ubuntu" |
no |
password | Password of the local user acocunt | string |
null |
no |
resource_group_name | The resource group name to create | string |
"self-hosted-runners" |
no |
runner_platform | Whether it is github or azure_devops used for runners | string |
"azure_devops" |
no |
sku | The sku to create virtual machines with | string |
"Standard_D2s_v3" |
no |
ssh_public_keys | n/a | list(string) |
[] |
no |
subnet_id | When provided, this subnet will be used for the scale set, rather than creating a new virtual network and subnet | string |
null |
no |
tags | n/a | map(any) |
{} |
no |
use_custom_subnet | Set to true if subnet_id is provided in order to actually use it (works around a TF issue) | bool |
false |
no |
use_existing_resource_group | Whether to use an existing resource group or not | bool |
false |
no |
username | Username of the local user account | string |
"runneradmin" |
no |
virtual_machine_scale_set_name | n/a | string |
"self-hosted-runners" |
no |
vmss_encryption_at_host_enabled | Enables encryption at host for the VMSS virtual machines. In order to use this option, the EncryptionAtHost feature must be enabled for Microsoft.Compue resource provider must be enabled for the subscription. To enable, use this PowerShell command: Register-AzProviderFeature -FeatureName 'EncryptionAtHost' -ProviderNamespace 'Microsoft.Compute'. | bool |
false |
no |
Name | Description |
---|---|
password | n/a |
virtual_machine_scale_set_id | n/a |
Name | Type |
---|---|
azurerm_lb.load_balancer | resource |
azurerm_lb_backend_address_pool.load_balancer | resource |
azurerm_lb_outbound_rule.outbound_rule | resource |
azurerm_linux_virtual_machine_scale_set.self_hosted_runners | resource |
azurerm_public_ip.load_balancer_pip | resource |
azurerm_resource_group.rg | resource |
azurerm_subnet.vmss | resource |
azurerm_virtual_network.vmss | resource |
azurerm_windows_virtual_machine_scale_set.self_hosted_runners | resource |
random_password.password | resource |