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

Commit b733248

Browse files
authored
fix: Volume size is ingored (#2014)
* fix: Volume size is ingored The problen is most likely introduces in one of the PR's to support multiple ebs. The following options for volumes are now supported. - Default, create an ebs for amazon linux - Provide explicit ebs mappings via block_device_mappings - No ebs, set block_device_mappings to [] - Decrecated! Overwrite the default volume size by setting volume_size close: #1954 * chore: fix formatting and terraform docs
1 parent 78e82c8 commit b733248

File tree

6 files changed

+34
-17
lines changed

6 files changed

+34
-17
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,13 @@ In case the setup does not work as intended follow the trace of events:
364364
| Name | Version |
365365
|------|---------|
366366
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14.1 |
367-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.38 |
367+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.50 |
368368

369369
## Providers
370370

371371
| Name | Version |
372372
|------|---------|
373-
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.38 |
373+
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.50 |
374374
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
375375

376376
## Modules
@@ -402,7 +402,7 @@ In case the setup does not work as intended follow the trace of events:
402402
| <a name="input_ami_owners"></a> [ami\_owners](#input\_ami\_owners) | The list of owners used to select the AMI of action runner instances. | `list(string)` | <pre>[<br> "amazon"<br>]</pre> | no |
403403
| <a name="input_aws_partition"></a> [aws\_partition](#input\_aws\_partition) | (optiona) partition in the arn namespace to use if not 'aws' | `string` | `"aws"` | no |
404404
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS region. | `string` | n/a | yes |
405-
| <a name="input_block_device_mappings"></a> [block\_device\_mappings](#input\_block\_device\_mappings) | The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops` | <pre>list(object({<br> device_name = string<br> delete_on_termination = bool<br> volume_type = string<br> volume_size = number<br> encrypted = bool<br> iops = number<br> }))</pre> | `[]` | no |
405+
| <a name="input_block_device_mappings"></a> [block\_device\_mappings](#input\_block\_device\_mappings) | The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops` | <pre>list(object({<br> device_name = string<br> delete_on_termination = bool<br> volume_type = string<br> volume_size = number<br> encrypted = bool<br> iops = number<br> }))</pre> | <pre>[<br> {<br> "delete_on_termination": true,<br> "device_name": "/dev/xvd",<br> "encrypted": true,<br> "iops": null,<br> "volume_size": 30,<br> "volume_type": "gp3"<br> }<br>]</pre> | no |
406406
| <a name="input_cloudwatch_config"></a> [cloudwatch\_config](#input\_cloudwatch\_config) | (optional) Replaces the module default cloudwatch log config. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html for details. | `string` | `null` | no |
407407
| <a name="input_create_service_linked_role_spot"></a> [create\_service\_linked\_role\_spot](#input\_create\_service\_linked\_role\_spot) | (optional) create the serviced linked role for spot instances that is required by the scale-up lambda. | `bool` | `false` | no |
408408
| <a name="input_delay_webhook_event"></a> [delay\_webhook\_event](#input\_delay\_webhook\_event) | The number of seconds the event accepted by the webhook is invisible on the queue before the scale up lambda will receive the event. | `number` | `30` | no |
@@ -480,7 +480,7 @@ In case the setup does not work as intended follow the trace of events:
480480
| <a name="input_userdata_post_install"></a> [userdata\_post\_install](#input\_userdata\_post\_install) | Script to be ran after the GitHub Actions runner is installed on the EC2 instances | `string` | `""` | no |
481481
| <a name="input_userdata_pre_install"></a> [userdata\_pre\_install](#input\_userdata\_pre\_install) | Script to be ran before the GitHub Actions runner is installed on the EC2 instances | `string` | `""` | no |
482482
| <a name="input_userdata_template"></a> [userdata\_template](#input\_userdata\_template) | Alternative user-data template, replacing the default template. By providing your own user\_data you have to take care of installing all required software, including the action runner. Variables userdata\_pre/post\_install are ignored. | `string` | `null` | no |
483-
| <a name="input_volume_size"></a> [volume\_size](#input\_volume\_size) | Size of runner volume | `number` | `30` | no |
483+
| <a name="input_volume_size"></a> [volume\_size](#input\_volume\_size) | (Deprecaated, use block\_device\_mappings. Size of runner volume, if set it overrides the value provide via block\_device\_mappings. | `number` | `null` | no |
484484
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | The VPC for security groups of the action runners. | `string` | n/a | yes |
485485
| <a name="input_webhook_lambda_s3_key"></a> [webhook\_lambda\_s3\_key](#input\_webhook\_lambda\_s3\_key) | S3 key for webhook lambda function. Required if using S3 bucket to specify lambdas. | `any` | `null` | no |
486486
| <a name="input_webhook_lambda_s3_object_version"></a> [webhook\_lambda\_s3\_object\_version](#input\_webhook\_lambda\_s3\_object\_version) | S3 object version for webhook lambda function. Useful if S3 versioning is enabled on source bucket. | `any` | `null` | no |

examples/default/main.tf

+6-4
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ module "runners" {
3030
webhook_secret = random_id.random.hex
3131
}
3232

33+
block_device_mappings = []
34+
3335
# Grab zip files via lambda_download
34-
webhook_lambda_zip = "lambdas-download/webhook.zip"
35-
runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
36-
runners_lambda_zip = "lambdas-download/runners.zip"
36+
# webhook_lambda_zip = "lambdas-download/webhook.zip"
37+
# runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
38+
# runners_lambda_zip = "lambdas-download/runners.zip"
3739

38-
enable_organization_runners = false
40+
enable_organization_runners = true
3941
runner_extra_labels = "default,example"
4042

4143
# enable access to the runners via SSM

modules/runners/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ yarn run dist
117117
| <a name="input_ami_owners"></a> [ami\_owners](#input\_ami\_owners) | The list of owners used to select the AMI of action runner instances. | `list(string)` | <pre>[<br> "amazon"<br>]</pre> | no |
118118
| <a name="input_aws_partition"></a> [aws\_partition](#input\_aws\_partition) | (optional) partition for the base arn if not 'aws' | `string` | `"aws"` | no |
119119
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS region. | `string` | n/a | yes |
120-
| <a name="input_block_device_mappings"></a> [block\_device\_mappings](#input\_block\_device\_mappings) | The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops` | <pre>list(object({<br> device_name = string<br> delete_on_termination = bool<br> volume_type = string<br> volume_size = number<br> encrypted = bool<br> iops = number<br> }))</pre> | `[]` | no |
120+
| <a name="input_block_device_mappings"></a> [block\_device\_mappings](#input\_block\_device\_mappings) | The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops` | <pre>list(object({<br> device_name = string<br> delete_on_termination = bool<br> volume_type = string<br> volume_size = number<br> encrypted = bool<br> iops = number<br> }))</pre> | <pre>[<br> {<br> "delete_on_termination": true,<br> "device_name": "/dev/xvd",<br> "encrypted": true,<br> "iops": null,<br> "volume_size": 30,<br> "volume_type": "gp3"<br> }<br>]</pre> | no |
121121
| <a name="input_cloudwatch_config"></a> [cloudwatch\_config](#input\_cloudwatch\_config) | (optional) Replaces the module default cloudwatch log config. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html for details. | `string` | `null` | no |
122122
| <a name="input_create_service_linked_role_spot"></a> [create\_service\_linked\_role\_spot](#input\_create\_service\_linked\_role\_spot) | (optional) create the service linked role for spot instances that is required by the scale-up lambda. | `bool` | `false` | no |
123123
| <a name="input_disable_runner_autoupdate"></a> [disable\_runner\_autoupdate](#input\_disable\_runner\_autoupdate) | Disable the auto update of the github runner agent. Be-aware there is a grace period of 30 days, see also the [GitHub article](https://github.blog/changelog/2022-02-01-github-actions-self-hosted-runners-can-now-disable-automatic-updates/) | `bool` | `false` | no |
@@ -186,7 +186,7 @@ yarn run dist
186186
| <a name="input_userdata_post_install"></a> [userdata\_post\_install](#input\_userdata\_post\_install) | User-data script snippet to insert after GitHub action runner install | `string` | `""` | no |
187187
| <a name="input_userdata_pre_install"></a> [userdata\_pre\_install](#input\_userdata\_pre\_install) | User-data script snippet to insert before GitHub action runner install | `string` | `""` | no |
188188
| <a name="input_userdata_template"></a> [userdata\_template](#input\_userdata\_template) | Alternative user-data template, replacing the default template. By providing your own user\_data you have to take care of installing all required software, including the action runner. Variables userdata\_pre/post\_install are ignored. | `string` | `null` | no |
189-
| <a name="input_volume_size"></a> [volume\_size](#input\_volume\_size) | Size of runner volume | `number` | `30` | no |
189+
| <a name="input_volume_size"></a> [volume\_size](#input\_volume\_size) | (Deprecaated, use block\_device\_mappings. Size of runner volume, if set it overrides the value provide via block\_device\_mappings. | `number` | `null` | no |
190190
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | The VPC for the security groups. | `string` | n/a | yes |
191191

192192
## Outputs
@@ -196,6 +196,7 @@ yarn run dist
196196
| <a name="output_lambda_scale_down"></a> [lambda\_scale\_down](#output\_lambda\_scale\_down) | n/a |
197197
| <a name="output_lambda_scale_up"></a> [lambda\_scale\_up](#output\_lambda\_scale\_up) | n/a |
198198
| <a name="output_launch_template"></a> [launch\_template](#output\_launch\_template) | n/a |
199+
| <a name="output_role_pool"></a> [role\_pool](#output\_role\_pool) | n/a |
199200
| <a name="output_role_runner"></a> [role\_runner](#output\_role\_runner) | n/a |
200201
| <a name="output_role_scale_down"></a> [role\_scale\_down](#output\_role\_scale\_down) | n/a |
201202
| <a name="output_role_scale_up"></a> [role\_scale\_up](#output\_role\_scale\_up) | n/a |

modules/runners/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ resource "aws_launch_template" "runner" {
6464
ebs {
6565
delete_on_termination = lookup(block_device_mappings.value, "delete_on_termination", true)
6666
volume_type = lookup(block_device_mappings.value, "volume_type", "gp3")
67-
volume_size = lookup(block_device_mappings.value, "volume_size", var.volume_size)
67+
volume_size = var.volume_size == null ? lookup(block_device_mappings.value, "volume_size", "30") : var.volume_size
6868
encrypted = lookup(block_device_mappings.value, "encrypted", true)
6969
iops = lookup(block_device_mappings.value, "iops", null)
7070
}

modules/runners/variables.tf

+10-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ variable "block_device_mappings" {
5555
encrypted = bool
5656
iops = number
5757
}))
58-
default = []
58+
default = [{
59+
device_name = "/dev/xvd"
60+
delete_on_termination = true
61+
volume_type = "gp3"
62+
volume_size = 30
63+
encrypted = true
64+
iops = null
65+
}]
5966
}
6067

6168
variable "market_options" {
@@ -397,9 +404,9 @@ variable "runner_additional_security_group_ids" {
397404
}
398405

399406
variable "volume_size" {
400-
description = "Size of runner volume"
407+
description = "(Deprecaated, use block_device_mappings. Size of runner volume, if set it overrides the value provide via block_device_mappings."
401408
type = number
402-
default = 30
409+
default = null
403410
}
404411

405412
variable "kms_key_arn" {

variables.tf

+10-3
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,14 @@ variable "block_device_mappings" {
233233
encrypted = bool
234234
iops = number
235235
}))
236-
default = []
236+
default = [{
237+
device_name = "/dev/xvd"
238+
delete_on_termination = true
239+
volume_type = "gp3"
240+
volume_size = 30
241+
encrypted = true
242+
iops = null
243+
}]
237244
}
238245

239246
variable "ami_filter" {
@@ -390,9 +397,9 @@ variable "instance_max_spot_price" {
390397
}
391398

392399
variable "volume_size" {
393-
description = "Size of runner volume"
400+
description = "(Deprecaated, use block_device_mappings. Size of runner volume, if set it overrides the value provide via block_device_mappings."
394401
type = number
395-
default = 30
402+
default = null
396403
}
397404

398405
variable "instance_type" {

0 commit comments

Comments
 (0)