diff --git a/README.md b/README.md index 5f7e33beeb..0d6829d79d 100644 --- a/README.md +++ b/README.md @@ -400,7 +400,7 @@ In case the setup does not work as intended follow the trace of events: | [ami\_owners](#input\_ami\_owners) | The list of owners used to select the AMI of action runner instances. | `list(string)` |
[
"amazon"
]
| no | | [aws\_partition](#input\_aws\_partition) | (optiona) partition in the arn namespace to use if not 'aws' | `string` | `"aws"` | no | | [aws\_region](#input\_aws\_region) | AWS region. | `string` | n/a | yes | -| [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` | `map(string)` | `{}` | no | +| [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` |
list(object({
device_name = string
delete_on_termination = bool
volume_type = string
volume_size = number
encrypted = bool
iops = number
}))
| `[]` | no | | [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 | | [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 | | [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 --git a/examples/ubuntu/main.tf b/examples/ubuntu/main.tf index d053d0d29b..e03ac544e7 100644 --- a/examples/ubuntu/main.tf +++ b/examples/ubuntu/main.tf @@ -56,10 +56,15 @@ module "runners" { # ami_owners = [data.aws_caller_identity.current.account_id] - block_device_mappings = { + block_device_mappings = [{ # Set the block device name for Ubuntu root device - device_name = "/dev/sda1" - } + device_name = "/dev/sda1" + delete_on_termination = true + volume_type = "gp3" + volume_size = 30 + encrypted = true + iops = null + }] runner_log_files = [ { diff --git a/modules/runners/README.md b/modules/runners/README.md index 208e675e4e..62b03b434c 100644 --- a/modules/runners/README.md +++ b/modules/runners/README.md @@ -117,7 +117,7 @@ yarn run dist | [ami\_owners](#input\_ami\_owners) | The list of owners used to select the AMI of action runner instances. | `list(string)` |
[
"amazon"
]
| no | | [aws\_partition](#input\_aws\_partition) | (optional) partition for the base arn if not 'aws' | `string` | `"aws"` | no | | [aws\_region](#input\_aws\_region) | AWS region. | `string` | n/a | yes | -| [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` | `map(string)` | `{}` | no | +| [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` |
list(object({
device_name = string
delete_on_termination = bool
volume_type = string
volume_size = number
encrypted = bool
iops = number
}))
| `[]` | no | | [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 | | [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 | | [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 --git a/modules/runners/main.tf b/modules/runners/main.tf index ff5c614f1a..7690c8d2cf 100644 --- a/modules/runners/main.tf +++ b/modules/runners/main.tf @@ -55,7 +55,7 @@ resource "aws_launch_template" "runner" { name = "${var.environment}-action-runner" dynamic "block_device_mappings" { - for_each = var.block_device_mappings != null ? [var.block_device_mappings] : [] + for_each = var.block_device_mappings != null ? var.block_device_mappings : [] content { device_name = lookup(block_device_mappings.value, "device_name", "/dev/xvda") diff --git a/modules/runners/variables.tf b/modules/runners/variables.tf index 8252f3c715..33742486ec 100644 --- a/modules/runners/variables.tf +++ b/modules/runners/variables.tf @@ -47,8 +47,15 @@ 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`" - type = map(string) - default = {} + type = list(object({ + device_name = string + delete_on_termination = bool + volume_type = string + volume_size = number + encrypted = bool + iops = number + })) + default = [] } variable "market_options" { diff --git a/variables.tf b/variables.tf index b2f65d5a51..f086a7c2b8 100644 --- a/variables.tf +++ b/variables.tf @@ -225,8 +225,15 @@ 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`" - type = map(string) - default = {} + type = list(object({ + device_name = string + delete_on_termination = bool + volume_type = string + volume_size = number + encrypted = bool + iops = number + })) + default = [] } variable "ami_filter" {