Skip to content

Commit f397709

Browse files
committed
feat: Add options throughput, kms_key_id, `snapshot_id to ebs block device mapping
1 parent 11f2a22 commit f397709

File tree

6 files changed

+38
-23
lines changed

6 files changed

+38
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ In case the setup does not work as intended follow the trace of events:
398398
| <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 |
399399
| <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 |
400400
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS region. | `string` | n/a | yes |
401-
| <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/xvda",<br> "encrypted": true,<br> "iops": null,<br> "volume_size": 30,<br> "volume_type": "gp3"<br> }<br>]</pre> | no |
401+
| <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`, `throughput`, `kms_key_id`, `snapshot_id`. | <pre>list(object({<br> delete_on_termination = bool<br> device_name = string<br> encrypted = bool<br> iops = number<br> kms_key_id = string<br> snapshot_id = string<br> throughput = number<br> volume_size = number<br> volume_type = string<br> }))</pre> | <pre>[<br> {<br> "delete_on_termination": true,<br> "device_name": "/dev/xvda",<br> "encrypted": true,<br> "iops": null,<br> "kms_key_id": null,<br> "snapshot_id": null,<br> "throughput": null,<br> "volume_size": 30,<br> "volume_type": "gp3"<br> }<br>]</pre> | no |
402402
| <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 |
403403
| <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 |
404404
| <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 |

examples/default/main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
locals {
2-
environment = "default"
2+
environment = "niek"
33
aws_region = "eu-west-1"
44
}
55

@@ -41,11 +41,11 @@ module "runners" {
4141
# }]
4242

4343
# Grab zip files via lambda_download
44-
webhook_lambda_zip = "lambdas-download/webhook.zip"
45-
runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
46-
runners_lambda_zip = "lambdas-download/runners.zip"
44+
# webhook_lambda_zip = "lambdas-download/webhook.zip"
45+
# runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
46+
# runners_lambda_zip = "lambdas-download/runners.zip"
4747

48-
enable_organization_runners = false
48+
enable_organization_runners = true
4949
runner_extra_labels = "default,example"
5050

5151
# enable access to the runners via SSM

modules/runners/README.md

Lines changed: 1 addition & 1 deletion
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> | <pre>[<br> {<br> "delete_on_termination": true,<br> "device_name": "/dev/xvda",<br> "encrypted": true,<br> "iops": null,<br> "volume_size": 30,<br> "volume_type": "gp3"<br> }<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`, `throughput`, `kms_key_id`, `snapshot_id`. | <pre>list(object({<br> delete_on_termination = bool<br> device_name = string<br> encrypted = bool<br> iops = number<br> kms_key_id = string<br> snapshot_id = string<br> throughput = number<br> volume_size = number<br> volume_type = string<br> }))</pre> | <pre>[<br> {<br> "delete_on_termination": true,<br> "device_name": "/dev/xvda",<br> "encrypted": true,<br> "iops": null,<br> "kms_key_id": null,<br> "snapshot_id": null,<br> "throughput": 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 |

modules/runners/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,13 @@ resource "aws_launch_template" "runner" {
6363

6464
ebs {
6565
delete_on_termination = block_device_mappings.value.delete_on_termination
66-
volume_type = block_device_mappings.value.volume_type
67-
volume_size = block_device_mappings.value.volume_size
6866
encrypted = block_device_mappings.value.encrypted
6967
iops = block_device_mappings.value.iops
68+
kms_key_id = block_device_mappings.value.kms_key_id
69+
snapshot_id = block_device_mappings.value.snapshot_id
70+
throughput = block_device_mappings.value.throughput
71+
volume_size = block_device_mappings.value.volume_size
72+
volume_type = block_device_mappings.value.volume_type
7073
}
7174
}
7275
}

modules/runners/variables.tf

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,28 @@ variable "s3_location_runner_binaries" {
4646
}
4747

4848
variable "block_device_mappings" {
49-
description = "The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops`"
49+
description = "The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops`, `throughput`, `kms_key_id`, `snapshot_id`."
5050
type = list(object({
51-
device_name = string
5251
delete_on_termination = bool
53-
volume_type = string
54-
volume_size = number
52+
device_name = string
5553
encrypted = bool
5654
iops = number
55+
kms_key_id = string
56+
snapshot_id = string
57+
throughput = number
58+
volume_size = number
59+
volume_type = string
5760
}))
5861
default = [{
59-
device_name = "/dev/xvda"
6062
delete_on_termination = true
61-
volume_type = "gp3"
62-
volume_size = 30
63+
device_name = "/dev/xvda"
6364
encrypted = true
6465
iops = null
66+
kms_key_id = null
67+
snapshot_id = null
68+
throughput = null
69+
volume_size = 30
70+
volume_type = "gp3"
6571
}]
6672
}
6773

variables.tf

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,22 +230,28 @@ variable "runner_allow_prerelease_binaries" {
230230
}
231231

232232
variable "block_device_mappings" {
233-
description = "The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops`"
233+
description = "The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops`, `throughput`, `kms_key_id`, `snapshot_id`."
234234
type = list(object({
235-
device_name = string
236235
delete_on_termination = bool
237-
volume_type = string
238-
volume_size = number
236+
device_name = string
239237
encrypted = bool
240238
iops = number
239+
kms_key_id = string
240+
snapshot_id = string
241+
throughput = number
242+
volume_size = number
243+
volume_type = string
241244
}))
242245
default = [{
243-
device_name = "/dev/xvda"
244246
delete_on_termination = true
245-
volume_type = "gp3"
246-
volume_size = 30
247+
device_name = "/dev/xvda"
247248
encrypted = true
248249
iops = null
250+
kms_key_id = null
251+
snapshot_id = null
252+
throughput = null
253+
volume_size = 30
254+
volume_type = "gp3"
249255
}]
250256
}
251257

0 commit comments

Comments
 (0)