Skip to content

Commit f8e191a

Browse files
authored
🐛 #30 - Add parameter to terraform to set max number of runners (#31)
1 parent fd8b3bc commit f8e191a

File tree

5 files changed

+44
-28
lines changed

5 files changed

+44
-28
lines changed

README.md

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -144,39 +144,41 @@ You are now ready to run action workloads on self hosted runner, remember builds
144144

145145
TODO
146146

147+
147148
## Inputs
148149

149-
| Name | Description | Type | Default | Required |
150-
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------- | :------: |
151-
| aws_region | AWS region. | `string` | n/a | yes |
152-
| enable_organization_runners | n/a | `bool` | n/a | yes |
153-
| environment | A name that identifies the environment, used as prefix and for tagging. | `string` | n/a | yes |
154-
| github_app | GitHub app parameters, see your github aapp. Ensure the key is base64 encoded. | <pre>object({<br> key_base64 = string<br> id = string<br> client_id = string<br> client_secret = string<br> webhook_secret = string<br> })</pre> | n/a | yes |
155-
| instance_profile_path | The path that will be added to the instance_profile, if not set the environment name will be used. | `string` | `null` | no |
156-
| minimum_running_time_in_minutes | The time an ec2 action runner should be running at minium before terminated if non busy. | `number` | `5` | no |
157-
| role_path | The path that will be added to role path for created roles, if not set the environment name will be used. | `string` | `null` | no |
158-
| role_permissions_boundary | Permissions boundary that will be added to the created roles. | `string` | `null` | no |
159-
| runner_as_root | Run the action runner under the root user. | `bool` | `false` | no |
160-
| runner_binaries_syncer_lambda_timeout | Time out of the binaries sync lambda in seconds. | `number` | `300` | no |
161-
| runner_binaries_syncer_lambda_zip | File location of the binaries sync lambda zip file. | `string` | `null` | no |
162-
| runner_extra_labels | Extra labels for the runners (GitHub). Separate each label by a comma | `string` | `""` | no |
163-
| runners_lambda_zip | File location of the lambda zip file for scaling runners. | `string` | `null` | no |
164-
| runners_scale_down_lambda_timeout | Time out for the scale up lambda in seconds. | `number` | `60` | no |
165-
| runners_scale_up_lambda_timeout | Time out for the scale down lambda in seconds. | `number` | `60` | no |
166-
| scale_down_schedule_expression | Scheduler expression to check every x for scale down. | `string` | `"cron(*/5 * * * ? *)"` | no |
167-
| 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 |
168-
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | `map(string)` | `{}` | no |
169-
| vpc_id | The VPC for security groups of the action runners. | `string` | n/a | yes |
170-
| webhook_lambda_timeout | Time out of the webhook lambda in seconds. | `number` | `10` | no |
171-
| webhook_lambda_zip | File location of the wehbook lambda zip file. | `string` | `null` | no |
150+
| Name | Description | Type | Default | Required |
151+
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | :------: |
152+
| aws\_region | AWS region. | `string` | n/a | yes |
153+
| enable\_organization\_runners | n/a | `bool` | n/a | yes |
154+
| environment | A name that identifies the environment, used as prefix and for tagging. | `string` | n/a | yes |
155+
| github\_app | GitHub app parameters, see your github aapp. Ensure the key is base64 encoded. | <pre>object({<br> key_base64 = string<br> id = string<br> client_id = string<br> client_secret = string<br> webhook_secret = string<br> })</pre> | n/a | yes |
156+
| 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 |
157+
| vpc\_id | The VPC for security groups of the action runners. | `string` | n/a | yes |
158+
| instance\_profile\_path | The path that will be added to the instance\_profile, if not set the environment name will be used. | `string` | `null` | no |
159+
| minimum\_running\_time\_in\_minutes | The time an ec2 action runner should be running at minium before terminated if non busy. | `number` | `5` | no |
160+
| role\_path | The path that will be added to role path for created roles, if not set the environment name will be used. | `string` | `null` | no |
161+
| role\_permissions\_boundary | Permissions boundary that will be added to the created roles. | `string` | `null` | no |
162+
| runner\_as\_root | Run the action runner under the root user. | `bool` | `false` | no |
163+
| runner\_binaries\_syncer\_lambda\_timeout | Time out of the binaries sync lambda in seconds. | `number` | `300` | no |
164+
| runner\_binaries\_syncer\_lambda\_zip | File location of the binaries sync lambda zip file. | `string` | `null` | no |
165+
| runner\_extra\_labels | Extra labels for the runners (GitHub). Separate each label by a comma | `string` | `""` | no |
166+
| runners\_lambda\_zip | File location of the lambda zip file for scaling runners. | `string` | `null` | no |
167+
| runners\_maxiumum\_count | The maxiumum number of runners tha will be created. | `number` | `3` | no |
168+
| runners\_scale\_down\_lambda\_timeout | Time out for the scale up lambda in seconds. | `number` | `60` | no |
169+
| runners\_scale\_up\_lambda\_timeout | Time out for the scale down lambda in seconds. | `number` | `60` | no |
170+
| scale\_down\_schedule\_expression | Scheduler expression to check every x for scale down. | `string` | `"cron(*/5 * * * ? *)"` | no |
171+
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | `map(string)` | `{}` | no |
172+
| webhook\_lambda\_timeout | Time out of the webhook lambda in seconds. | `number` | `10` | no |
173+
| webhook\_lambda\_zip | File location of the wehbook lambda zip file. | `string` | `null` | no |
172174

173175
## Outputs
174176

175-
| Name | Description |
176-
| --------------- | ----------- |
177-
| binaries_syncer | n/a |
178-
| runners | n/a |
179-
| webhook | n/a |
177+
| Name | Description |
178+
| ---------------- | ----------- |
179+
| binaries\_syncer | n/a |
180+
| runners | n/a |
181+
| webhook | n/a |
180182

181183
## Philips Forest
182184

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ module "runners" {
5959
minimum_running_time_in_minutes = var.minimum_running_time_in_minutes
6060
runner_extra_labels = var.runner_extra_labels
6161
runner_as_root = var.runner_as_root
62+
runners_maxiumum_count = var.runners_maxiumum_count
6263

6364
lambda_zip = var.runners_lambda_zip
6465
lambda_timeout_scale_up = var.runners_scale_up_lambda_timeout

modules/runners/scale-up.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ resource "aws_lambda_function" "scale_up" {
1313
variables = {
1414
ENABLE_ORGANIZATION_RUNNERS = var.enable_organization_runners
1515
RUNNER_EXTRA_LABELS = var.runner_extra_labels
16+
RUNNERS_MAXIMUM_COUNT = var.runners_maxiumum_count
1617
GITHUB_APP_KEY_BASE64 = var.github_app.key_base64
1718
GITHUB_APP_ID = var.github_app.id
1819
GITHUB_APP_CLIENT_ID = var.github_app.client_id

modules/runners/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,9 @@ variable "runner_as_root" {
173173
type = bool
174174
default = false
175175
}
176+
177+
variable "runners_maxiumum_count" {
178+
description = "The maxiumum number of runners tha will be created."
179+
type = number
180+
default = 3
181+
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,9 @@ variable "runner_as_root" {
125125
type = bool
126126
default = false
127127
}
128+
129+
variable "runners_maxiumum_count" {
130+
description = "The maxiumum number of runners tha will be created."
131+
type = number
132+
default = 3
133+
}

0 commit comments

Comments
 (0)