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

Commit 7cd2524

Browse files
authored
feat: Add options extra option to ebs block device mapping (#2052)
* feat: Add options `throughput`, `kms_key_id`, `snapshot_id to ebs block device mapping * fix examples
1 parent 50edade commit 7cd2524

File tree

6 files changed

+36
-18
lines changed

6 files changed

+36
-18
lines changed

Diff for: README.md

+1-1
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 |

Diff for: examples/ubuntu/main.tf

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ module "runners" {
6464
volume_size = 30
6565
encrypted = true
6666
iops = null
67+
throughput = null
68+
kms_key_id = null
69+
snapshot_id = null
6770
}]
6871

6972
runner_log_files = [

Diff for: modules/runners/README.md

+1-1
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 |

Diff for: modules/runners/main.tf

+5-2
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
}

Diff for: modules/runners/variables.tf

+13-7
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,28 @@ variable "s3_location_runner_binaries" {
5858
}
5959

6060
variable "block_device_mappings" {
61-
description = "The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops`"
61+
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`."
6262
type = list(object({
63-
device_name = string
6463
delete_on_termination = bool
65-
volume_type = string
66-
volume_size = number
64+
device_name = string
6765
encrypted = bool
6866
iops = number
67+
kms_key_id = string
68+
snapshot_id = string
69+
throughput = number
70+
volume_size = number
71+
volume_type = string
6972
}))
7073
default = [{
71-
device_name = "/dev/xvda"
7274
delete_on_termination = true
73-
volume_type = "gp3"
74-
volume_size = 30
75+
device_name = "/dev/xvda"
7576
encrypted = true
7677
iops = null
78+
kms_key_id = null
79+
snapshot_id = null
80+
throughput = null
81+
volume_size = 30
82+
volume_type = "gp3"
7783
}]
7884
}
7985

Diff for: variables.tf

+13-7
Original file line numberDiff line numberDiff line change
@@ -242,22 +242,28 @@ variable "runner_allow_prerelease_binaries" {
242242
}
243243

244244
variable "block_device_mappings" {
245-
description = "The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops`"
245+
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`."
246246
type = list(object({
247-
device_name = string
248247
delete_on_termination = bool
249-
volume_type = string
250-
volume_size = number
248+
device_name = string
251249
encrypted = bool
252250
iops = number
251+
kms_key_id = string
252+
snapshot_id = string
253+
throughput = number
254+
volume_size = number
255+
volume_type = string
253256
}))
254257
default = [{
255-
device_name = "/dev/xvda"
256258
delete_on_termination = true
257-
volume_type = "gp3"
258-
volume_size = 30
259+
device_name = "/dev/xvda"
259260
encrypted = true
260261
iops = null
262+
kms_key_id = null
263+
snapshot_id = null
264+
throughput = null
265+
volume_size = 30
266+
volume_type = "gp3"
261267
}]
262268
}
263269

0 commit comments

Comments
 (0)