From 40e6b3a66236fba797269607831f96c9bd743865 Mon Sep 17 00:00:00 2001 From: edersonbrilhante Date: Thu, 3 Sep 2026 21:34:31 +0200 Subject: [PATCH 1/2] fix(multi-runner): route v1 and v2 runners separately --- modules/multi-runner/outputs.tf | 12 ++++++ modules/multi-runner/runners.experimental.tf | 38 +++++++++++++++++++ modules/multi-runner/runners.tf | 7 +++- .../tests/config-resolution.tftest.hcl | 20 ++++++++++ 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 modules/multi-runner/runners.experimental.tf diff --git a/modules/multi-runner/outputs.tf b/modules/multi-runner/outputs.tf index 7c4a9807d1..4c7d4a6cd3 100644 --- a/modules/multi-runner/outputs.tf +++ b/modules/multi-runner/outputs.tf @@ -21,6 +21,18 @@ output "runners_map" { } } +output "runners_map_v2" { + value = { for runner_key, runner in module.runner_configs : runner_key => { + runner = runner.runner + orchestration_provider = runner.orchestration_provider + scale_up = runner.scale_up + scale_down = runner.scale_down + pool = runner.pool + provider = runner.provider + } + } +} + output "binaries_syncer_map" { value = { for runner_binary_key, runner_binary in module.runner_binaries : runner_binary_key => { lambda = runner_binary.lambda diff --git a/modules/multi-runner/runners.experimental.tf b/modules/multi-runner/runners.experimental.tf new file mode 100644 index 0000000000..4e8652aa00 --- /dev/null +++ b/modules/multi-runner/runners.experimental.tf @@ -0,0 +1,38 @@ +module "runner_configs" { + source = "../runner-config" + for_each = { + for runner_key, runner_config in local.effective_config.multi_runner_config : + runner_key => runner_config if local.use_v2_config + } + + aws_region = var.aws_region + aws_partition = var.aws_partition + prefix = "${var.prefix}-${each.key}" + + tags = merge( + each.value.tags, + { "ghr:environment" = var.prefix }, + ) + runner = each.value.runner + github = merge(each.value.github, { + app_parameters = local.github_app_parameters + }) + lambda = each.value.lambda + orchestration_provider = { + webhook = each.value.orchestration_provider.webhook == null ? null : { + runner = each.value.orchestration_provider.webhook.runner + github = each.value.orchestration_provider.webhook.github + queue = merge(each.value.orchestration_provider.webhook.queue, { + build = { + arn = aws_sqs_queue.queued_builds[each.key].arn + url = aws_sqs_queue.queued_builds[each.key].url + } + }) + lambda = each.value.orchestration_provider.webhook.lambda + job_retry = each.value.orchestration_provider.webhook.job_retry + } + } + ssm = each.value.ssm + observability = each.value.observability + compute_provider = each.value.compute_provider +} diff --git a/modules/multi-runner/runners.tf b/modules/multi-runner/runners.tf index 61c5f57583..5e0bc44022 100644 --- a/modules/multi-runner/runners.tf +++ b/modules/multi-runner/runners.tf @@ -1,6 +1,9 @@ module "runners" { - source = "../runners" - for_each = local.effective_config.multi_runner_config + source = "../runners" + for_each = { + for runner_key, runner_config in local.effective_config.multi_runner_config : + runner_key => runner_config if !local.use_v2_config + } aws_region = var.aws_region aws_partition = var.aws_partition vpc_id = each.value.compute_provider.aws.ec2.vpc_id diff --git a/modules/multi-runner/tests/config-resolution.tftest.hcl b/modules/multi-runner/tests/config-resolution.tftest.hcl index 84d78c4411..e90594a0d9 100644 --- a/modules/multi-runner/tests/config-resolution.tftest.hcl +++ b/modules/multi-runner/tests/config-resolution.tftest.hcl @@ -193,6 +193,16 @@ run "v1_stable_inputs_translate_into_effective_base" { ) error_message = "Stable v1 inputs must translate into the effective experimental base without leaking v2 globals." } + + assert { + condition = ( + keys(module.runners) == ["stable"] + && length(module.runner_configs) == 0 + && keys(output.runners_map) == ["stable"] + && length(output.runners_map_v2) == 0 + ) + error_message = "Stable v1 configurations must route through module.runners and not the experimental runner-config module." + } } run "v2_inputs_resolve_lane_over_global" { @@ -372,4 +382,14 @@ run "v2_inputs_resolve_lane_over_global" { ) error_message = "v2 inputs must resolve lane overrides before v2 global defaults." } + + assert { + condition = ( + length(module.runners) == 0 + && keys(module.runner_configs) == ["lane"] + && length(output.runners_map) == 0 + && keys(output.runners_map_v2) == ["lane"] + ) + error_message = "Experimental v2 configurations must route through module.runner_configs and skip the legacy runners module." + } } From 0d2262ea8c80c13128250392a31357f2693668be Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 19:35:31 +0000 Subject: [PATCH 2/2] docs: auto update terraform docs --- modules/multi-runner/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/multi-runner/README.md b/modules/multi-runner/README.md index 61a558389f..15cd8ef307 100644 --- a/modules/multi-runner/README.md +++ b/modules/multi-runner/README.md @@ -155,6 +155,7 @@ multi_runner_config = { | [ami\_housekeeper](#module\_ami\_housekeeper) | ../ami-housekeeper | n/a | | [instance\_termination\_watcher](#module\_instance\_termination\_watcher) | ../termination-watcher | n/a | | [runner\_binaries](#module\_runner\_binaries) | ../runner-binaries-syncer | n/a | +| [runner\_configs](#module\_runner\_configs) | ../runner-config | n/a | | [runners](#module\_runners) | ../runners | n/a | | [ssm](#module\_ssm) | ../ssm | n/a | | [webhook](#module\_webhook) | ../webhook | n/a | @@ -270,6 +271,7 @@ multi_runner_config = { | [instance\_termination\_handler](#output\_instance\_termination\_handler) | n/a | | [instance\_termination\_watcher](#output\_instance\_termination\_watcher) | n/a | | [runners\_map](#output\_runners\_map) | n/a | +| [runners\_map\_v2](#output\_runners\_map\_v2) | n/a | | [ssm\_parameters](#output\_ssm\_parameters) | n/a | | [webhook](#output\_webhook) | n/a |