Skip to content

Commit 1288c81

Browse files
taharahnpalm
andauthored
feat: allow setting VPC and subnets per runner (#3467)
This allows passing in a different VPC and subnet IDs for each runner config and falling back to the "global" value set via the existing `vpc_id` and `subnet_ids` variables. --------- Co-authored-by: Niek Palm <[email protected]>
1 parent 1c87fc5 commit 1288c81

File tree

17 files changed

+109
-17
lines changed

17 files changed

+109
-17
lines changed

.terraform.lock.hcl

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/arm64/.terraform.lock.hcl

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/base/.terraform.lock.hcl

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/default/.terraform.lock.hcl

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/ephemeral/.terraform.lock.hcl

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/lambdas-download/.terraform.lock.hcl

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/multi-runner/.terraform.lock.hcl

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/multi-runner/main.tf

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,27 @@ locals {
33
aws_region = "eu-west-1"
44

55
# Load runner configurations from Yaml files
6-
multi_runner_config = { for c in fileset("${path.module}/templates/runner-configs", "*.yaml") : trimsuffix(c, ".yaml") => yamldecode(file("${path.module}/templates/runner-configs/${c}")) }
6+
multi_runner_config_files = {
7+
for c in fileset("${path.module}/templates/runner-configs", "*.yaml") :
8+
9+
trimsuffix(c, ".yaml") => yamldecode(file("${path.module}/templates/runner-configs/${c}"))
10+
}
11+
multi_runner_config = {
12+
for k, v in local.multi_runner_config_files :
13+
14+
k => merge(
15+
v,
16+
{
17+
runner_config = merge(
18+
v.runner_config,
19+
{
20+
subnet_ids = lookup(v.runner_config, "subnet_ids", null) != null ? [module.base.vpc.private_subnets[0]] : null
21+
vpc_id = lookup(v.runner_config, "vpc_id", null) != null ? module.base.vpc.vpc_id : null
22+
}
23+
)
24+
}
25+
)
26+
}
727
}
828

929
resource "random_id" "random" {

examples/multi-runner/templates/runner-configs/linux-x64.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ runner_config:
99
runner_architecture: x64
1010
runner_name_prefix: amazon-x64_
1111
enable_ssm_on_runners: true
12+
vpc_id: ${vpc_id}
13+
subnet_ids: ${subnet_ids}
1214
instance_types:
1315
- m5ad.large
1416
- m5a.large

examples/permissions-boundary/.terraform.lock.hcl

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)