Skip to content

Commit 174293c

Browse files
stuartp44npalm
andauthored
fix(runners): correct regex pattern for extracting AMI ID from SSM parameter ARN (#4981)
This PR creates a small change to the regex group that ensures the correct ami_id_ssm_parameter_arn value is passed in its fullest to the env of the scale-up lambda. At the moment, this is missing the leading '/' and thus causes ```Error processing batch (size: 3): Failed to lookup runner AMI ID from SSM parameter: github-action-runners/staging-multi/<redacted>-ubuntu-x64/runners/config/ami_id,\n GetParameterError: User: arn:aws:sts::<redacted>:assumed-role/staging-multi-<redacted>-ubu-x64-med-scale-up-lambda-<redacted>/staging-multi-<redacted>-ubu-x64-med-scale-up is not authorized to perform: ssm:GetParameter on resource: arn:aws:ssm:<redacted>:<redacted>:* because no identity-based policy allows the ssm:GetParameter action, ignoring batch",```. closes #4959 Co-authored-by: Niek Palm <[email protected]>
1 parent 4af194d commit 174293c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/runners/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ locals {
4848
ami_filter = merge(local.default_ami[var.runner_os], local.ami_config.filter)
4949
ami_id_ssm_module_managed = local.ami_config.id_ssm_parameter_arn == null
5050
# Extract parameter name from ARN (format: arn:aws:ssm:region:account:parameter/path/to/param)
51-
ami_id_ssm_parameter_name = local.ami_id_ssm_module_managed ? null : try(regex("parameter/(.+)$", local.ami_config.id_ssm_parameter_arn)[0], null)
51+
ami_id_ssm_parameter_name = local.ami_id_ssm_module_managed ? null : try(regex("parameter(/.+)$", local.ami_config.id_ssm_parameter_arn)[0], null)
5252

5353
enable_job_queued_check = var.enable_job_queued_check == null ? !var.enable_ephemeral_runners : var.enable_job_queued_check
5454

0 commit comments

Comments
 (0)