diff --git a/modules/runners/runner-config.tf b/modules/runners/runner-config.tf index 684873a7ff..f656f84a06 100644 --- a/modules/runners/runner-config.tf +++ b/modules/runners/runner-config.tf @@ -12,6 +12,13 @@ resource "aws_ssm_parameter" "runner_agent_mode" { tags = local.tags } +resource "aws_ssm_parameter" "gh_url" { + name = "${var.ssm_paths.root}/${var.ssm_paths.config}/gh_url" + type = "String" + value = var.enable_ephemeral_runners ? "ephemeral" : "persistent" + tags = local.tags +} + resource "aws_ssm_parameter" "jit_config_enabled" { name = "${var.ssm_paths.root}/${var.ssm_paths.config}/enable_jit_config" type = "String" diff --git a/modules/runners/templates/start-runner.ps1 b/modules/runners/templates/start-runner.ps1 index 5046d3e9dd..b0558e07cd 100644 --- a/modules/runners/templates/start-runner.ps1 +++ b/modules/runners/templates/start-runner.ps1 @@ -54,6 +54,9 @@ Write-Host "Retrieved $ssm_config_path/agent_mode parameter - ($agent_mode)" $token_path=$parameters.where( {$_.Name -eq "$ssm_config_path/token_path"}).value Write-Host "Retrieved $ssm_config_path/token_path parameter - ($token_path)" +$gh_url=$parameters.where( {$_.Name -eq "$ssm_config_path/gh_url"}).value +Write-Host "Retrieved $ssm_config_path/gh_url parameter - ($gh_url)" + if ($enable_cloudwatch_agent -eq "true") { @@ -107,7 +110,7 @@ foreach ($group in @("Administrators", "docker-users")) { Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin -Value 0 -Force Write-Host "Disabled User Access Control (UAC)" -$configCmd = ".\config.cmd --unattended --name $runner_name_prefix$InstanceId --work `"_work`" $config" +$configCmd = ".\config.cmd --unattended --url $gh_url --name $runner_name_prefix$InstanceId --work `"_work`" $config" Write-Host "Configure GH Runner as user $run_as" Invoke-Expression $configCmd diff --git a/modules/runners/variables.tf b/modules/runners/variables.tf index 5c56917259..bc35a7cf7d 100644 --- a/modules/runners/variables.tf +++ b/modules/runners/variables.tf @@ -392,6 +392,12 @@ variable "runner_log_files" { default = null } +variable "gh_url" { + description = "GitHub URL with Org ID included." + type = string + default = null +} + variable "ghes_url" { description = "GitHub Enterprise Server URL. DO NOT SET IF USING PUBLIC GITHUB" type = string