Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/multi-runner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ module "multi-runner" {
| <a name="module_ami_housekeeper"></a> [ami\_housekeeper](#module\_ami\_housekeeper) | ../ami-housekeeper | n/a |
| <a name="module_instance_termination_watcher"></a> [instance\_termination\_watcher](#module\_instance\_termination\_watcher) | ../termination-watcher | n/a |
| <a name="module_runner_binaries"></a> [runner\_binaries](#module\_runner\_binaries) | ../runner-binaries-syncer | n/a |
| <a name="module_runner_configs"></a> [runner\_configs](#module\_runner\_configs) | ../runner-config | n/a |
| <a name="module_runners"></a> [runners](#module\_runners) | ../runners | n/a |
| <a name="module_ssm"></a> [ssm](#module\_ssm) | ../ssm | n/a |
| <a name="module_webhook"></a> [webhook](#module\_webhook) | ../webhook | n/a |
Expand Down Expand Up @@ -232,6 +233,7 @@ module "multi-runner" {
| <a name="output_instance_termination_handler"></a> [instance\_termination\_handler](#output\_instance\_termination\_handler) | n/a |
| <a name="output_instance_termination_watcher"></a> [instance\_termination\_watcher](#output\_instance\_termination\_watcher) | n/a |
| <a name="output_runners_map"></a> [runners\_map](#output\_runners\_map) | n/a |
| <a name="output_runners_map_v2"></a> [runners\_map\_v2](#output\_runners\_map\_v2) | n/a |
| <a name="output_ssm_parameters"></a> [ssm\_parameters](#output\_ssm\_parameters) | n/a |
| <a name="output_webhook"></a> [webhook](#output\_webhook) | n/a |
<!-- END_TF_DOCS -->
12 changes: 12 additions & 0 deletions modules/multi-runner/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 38 additions & 0 deletions modules/multi-runner/runners.experimental.tf
Original file line number Diff line number Diff line change
@@ -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
}
7 changes: 5 additions & 2 deletions modules/multi-runner/runners.tf
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 20 additions & 0 deletions modules/multi-runner/tests/config-resolution.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,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_experimental_inputs_resolve_lane_over_global" {
Expand Down Expand Up @@ -387,4 +397,14 @@ run "v2_experimental_inputs_resolve_lane_over_global" {
)
error_message = "Experimental v2 inputs must resolve lane overrides before experimental 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."
}
}
Loading