Skip to content

Commit

Permalink
feat: Add options extra option to ebs block device mapping (#2052)
Browse files Browse the repository at this point in the history
* feat: Add options `throughput`, `kms_key_id`, `snapshot_id to ebs block device mapping

* fix examples
  • Loading branch information
npalm authored Jul 25, 2022
1 parent 50edade commit 7cd2524
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ In case the setup does not work as intended follow the trace of events:
| <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 |
| <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 |
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS region. | `string` | n/a | yes |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
Expand Down
3 changes: 3 additions & 0 deletions examples/ubuntu/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ module "runners" {
volume_size = 30
encrypted = true
iops = null
throughput = null
kms_key_id = null
snapshot_id = null
}]

runner_log_files = [
Expand Down
2 changes: 1 addition & 1 deletion modules/runners/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ yarn run dist
| <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 |
| <a name="input_aws_partition"></a> [aws\_partition](#input\_aws\_partition) | (optional) partition for the base arn if not 'aws' | `string` | `"aws"` | no |
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS region. | `string` | n/a | yes |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
Expand Down
7 changes: 5 additions & 2 deletions modules/runners/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ resource "aws_launch_template" "runner" {

ebs {
delete_on_termination = block_device_mappings.value.delete_on_termination
volume_type = block_device_mappings.value.volume_type
volume_size = block_device_mappings.value.volume_size
encrypted = block_device_mappings.value.encrypted
iops = block_device_mappings.value.iops
kms_key_id = block_device_mappings.value.kms_key_id
snapshot_id = block_device_mappings.value.snapshot_id
throughput = block_device_mappings.value.throughput
volume_size = block_device_mappings.value.volume_size
volume_type = block_device_mappings.value.volume_type
}
}
}
Expand Down
20 changes: 13 additions & 7 deletions modules/runners/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,28 @@ variable "s3_location_runner_binaries" {
}

variable "block_device_mappings" {
description = "The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops`"
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`."
type = list(object({
device_name = string
delete_on_termination = bool
volume_type = string
volume_size = number
device_name = string
encrypted = bool
iops = number
kms_key_id = string
snapshot_id = string
throughput = number
volume_size = number
volume_type = string
}))
default = [{
device_name = "/dev/xvda"
delete_on_termination = true
volume_type = "gp3"
volume_size = 30
device_name = "/dev/xvda"
encrypted = true
iops = null
kms_key_id = null
snapshot_id = null
throughput = null
volume_size = 30
volume_type = "gp3"
}]
}

Expand Down
20 changes: 13 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -242,22 +242,28 @@ variable "runner_allow_prerelease_binaries" {
}

variable "block_device_mappings" {
description = "The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops`"
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`."
type = list(object({
device_name = string
delete_on_termination = bool
volume_type = string
volume_size = number
device_name = string
encrypted = bool
iops = number
kms_key_id = string
snapshot_id = string
throughput = number
volume_size = number
volume_type = string
}))
default = [{
device_name = "/dev/xvda"
delete_on_termination = true
volume_type = "gp3"
volume_size = 30
device_name = "/dev/xvda"
encrypted = true
iops = null
kms_key_id = null
snapshot_id = null
throughput = null
volume_size = 30
volume_type = "gp3"
}]
}

Expand Down

0 comments on commit 7cd2524

Please sign in to comment.