Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit 23ee630

Browse files
authored
feat: Add option to configure concurrent running scale up lambda (#1415)
Allow > 1 reserved_concurrent_executions for the scale-up lambda function. This is needed when using a strategy matrix in a workflow.
1 parent fe65a5f commit 23ee630

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ In case the setup does not work as intended follow the trace of events:
417417
| <a name="input_runners_scale_down_lambda_timeout"></a> [runners\_scale\_down\_lambda\_timeout](#input\_runners\_scale\_down\_lambda\_timeout) | Time out for the scale down lambda in seconds. | `number` | `60` | no |
418418
| <a name="input_runners_scale_up_lambda_timeout"></a> [runners\_scale\_up\_lambda\_timeout](#input\_runners\_scale\_up\_lambda\_timeout) | Time out for the scale up lambda in seconds. | `number` | `180` | no |
419419
| <a name="input_scale_down_schedule_expression"></a> [scale\_down\_schedule\_expression](#input\_scale\_down\_schedule\_expression) | Scheduler expression to check every x for scale down. | `string` | `"cron(*/5 * * * ? *)"` | no |
420+
| <a name="input_scale_up_reserved_concurrent_executions"></a> [scale\_up\_reserved\_concurrent\_executions](#input\_scale\_up\_reserved\_concurrent\_executions) | Amount of reserved concurrent executions for the scale-up lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations. | `number` | `1` | no |
420421
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc_id`. | `list(string)` | n/a | yes |
421422
| <a name="input_syncer_lambda_s3_key"></a> [syncer\_lambda\_s3\_key](#input\_syncer\_lambda\_s3\_key) | S3 key for syncer lambda function. Required if using S3 bucket to specify lambdas. | `any` | `null` | no |
422423
| <a name="input_syncer_lambda_s3_object_version"></a> [syncer\_lambda\_s3\_object\_version](#input\_syncer\_lambda\_s3\_object\_version) | S3 object version for syncer lambda function. Useful if S3 versioning is enabled on source bucket. | `any` | `null` | no |

Diff for: main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ module "runners" {
119119
runner_log_files = var.runner_log_files
120120
runner_group_name = var.runner_group_name
121121

122+
scale_up_reserved_concurrent_executions = var.scale_up_reserved_concurrent_executions
123+
122124
instance_profile_path = var.instance_profile_path
123125
role_path = var.role_path
124126
role_permissions_boundary = var.role_permissions_boundary

Diff for: modules/runners/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ No modules.
156156
| <a name="input_s3_bucket_runner_binaries"></a> [s3\_bucket\_runner\_binaries](#input\_s3\_bucket\_runner\_binaries) | n/a | <pre>object({<br> arn = string<br> })</pre> | n/a | yes |
157157
| <a name="input_s3_location_runner_binaries"></a> [s3\_location\_runner\_binaries](#input\_s3\_location\_runner\_binaries) | S3 location of runner distribution. | `string` | n/a | yes |
158158
| <a name="input_scale_down_schedule_expression"></a> [scale\_down\_schedule\_expression](#input\_scale\_down\_schedule\_expression) | Scheduler expression to check every x for scale down. | `string` | `"cron(*/5 * * * ? *)"` | no |
159+
| <a name="input_scale_up_reserved_concurrent_executions"></a> [scale\_up\_reserved\_concurrent\_executions](#input\_scale\_up\_reserved\_concurrent\_executions) | Amount of reserved concurrent executions for the scale-up lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations. | `number` | `1` | no |
159160
| <a name="input_sqs_build_queue"></a> [sqs\_build\_queue](#input\_sqs\_build\_queue) | SQS queue to consume accepted build events. | <pre>object({<br> arn = string<br> })</pre> | n/a | yes |
160161
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc_id`. | `list(string)` | n/a | yes |
161162
| <a name="input_tags"></a> [tags](#input\_tags) | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | `map(string)` | `{}` | no |

Diff for: modules/runners/scale-up.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ resource "aws_lambda_function" "scale_up" {
99
handler = "index.scaleUpHandler"
1010
runtime = "nodejs14.x"
1111
timeout = var.lambda_timeout_scale_up
12-
reserved_concurrent_executions = 1
12+
reserved_concurrent_executions = var.scale_up_reserved_concurrent_executions
1313
memory_size = 512
1414
tags = local.tags
1515

Diff for: modules/runners/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ variable "lambda_timeout_scale_down" {
163163
default = 60
164164
}
165165

166+
variable "scale_up_reserved_concurrent_executions" {
167+
description = "Amount of reserved concurrent executions for the scale-up lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations."
168+
type = number
169+
default = 1
170+
}
171+
166172
variable "lambda_timeout_scale_up" {
167173
description = "Time out for the scale up lambda in seconds."
168174
type = number

Diff for: variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ variable "runner_group_name" {
6969
default = "Default"
7070
}
7171

72+
variable "scale_up_reserved_concurrent_executions" {
73+
description = "Amount of reserved concurrent executions for the scale-up lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations."
74+
type = number
75+
default = 1
76+
}
77+
7278
variable "webhook_lambda_zip" {
7379
description = "File location of the webhook lambda zip file."
7480
type = string

0 commit comments

Comments
 (0)