Skip to content

Commit cb534c6

Browse files
committed
add example to use a public parameter
1 parent ada0b63 commit cb534c6

File tree

3 files changed

+11
-43
lines changed

3 files changed

+11
-43
lines changed

examples/multi-runner/main.tf

+10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1+
data "aws_ssm_parameter" "al2023_arm" {
2+
name = "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64"
3+
}
4+
15
locals {
26
environment = var.environment != null ? var.environment : "multi-runner"
37
aws_region = var.aws_region
48

9+
# create map only with amazon linux 2023 x64 ami id
10+
ssm_ami_ids = {
11+
"linux-x64" = data.aws_ssm_parameter.al2023_arm.arn
12+
}
13+
514
# Load runner configurations from Yaml files
615
multi_runner_config_files = {
716
for c in fileset("${path.module}/templates/runner-configs", "*.yaml") :
@@ -19,6 +28,7 @@ locals {
1928
{
2029
subnet_ids = lookup(v.runner_config, "subnet_ids", null) != null ? [module.base.vpc.private_subnets[0]] : null
2130
vpc_id = lookup(v.runner_config, "vpc_id", null) != null ? module.base.vpc.vpc_id : null
31+
ami_id_ssm_parameter_arn = lookup(local.ssm_ami_ids, k, null) != null ? local.ssm_ami_ids[k] : null
2232
}
2333
)
2434
}

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

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ runner_config:
1414
instance_types:
1515
- m5ad.large
1616
- m5a.large
17+
ami_id_ssm_parameter_arn: ${ami_id_ssm_parameter_arn}
1718
runners_maximum_count: 1
1819
enable_ephemeral_runners: true
1920
enable_on_demand_failover_for_errors: ['InsufficientInstanceCapacity']

examples/test/main.tf

-43
This file was deleted.

0 commit comments

Comments
 (0)