Skip to content

Commit

Permalink
fix: Volume size is ingored
Browse files Browse the repository at this point in the history
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
  • Loading branch information
npalm committed May 4, 2022
1 parent d2783ff commit 4e803b2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
10 changes: 6 additions & 4 deletions examples/default/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ module "runners" {
id = var.github_app_id
webhook_secret = random_id.random.hex
}

block_device_mappings = []

# Grab zip files via lambda_download
webhook_lambda_zip = "lambdas-download/webhook.zip"
runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
runners_lambda_zip = "lambdas-download/runners.zip"
# webhook_lambda_zip = "lambdas-download/webhook.zip"
# runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
# runners_lambda_zip = "lambdas-download/runners.zip"

enable_organization_runners = false
enable_organization_runners = true
runner_extra_labels = "default,example"

# enable access to the runners via SSM
Expand Down
2 changes: 1 addition & 1 deletion modules/runners/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ resource "aws_launch_template" "runner" {
ebs {
delete_on_termination = lookup(block_device_mappings.value, "delete_on_termination", true)
volume_type = lookup(block_device_mappings.value, "volume_type", "gp3")
volume_size = lookup(block_device_mappings.value, "volume_size", var.volume_size)
volume_size = var.volume_size == null ? lookup(block_device_mappings.value, "volume_size", "30"): var.volume_size
encrypted = lookup(block_device_mappings.value, "encrypted", true)
iops = lookup(block_device_mappings.value, "iops", null)
}
Expand Down
13 changes: 10 additions & 3 deletions modules/runners/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ variable "block_device_mappings" {
encrypted = bool
iops = number
}))
default = []
default = [{
device_name = "/dev/xvd"
delete_on_termination = true
volume_type = "gp3"
volume_size = 30
encrypted = true
iops = null
}]
}

variable "market_options" {
Expand Down Expand Up @@ -397,9 +404,9 @@ variable "runner_additional_security_group_ids" {
}

variable "volume_size" {
description = "Size of runner volume"
description = "(Deprecaated, use block_device_mappings. Size of runner volume, if set it overrides the value provide via block_device_mappings."
type = number
default = 30
default = null
}

variable "kms_key_arn" {
Expand Down
13 changes: 10 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,14 @@ variable "block_device_mappings" {
encrypted = bool
iops = number
}))
default = []
default = [{
device_name = "/dev/xvd"
delete_on_termination = true
volume_type = "gp3"
volume_size = 30
encrypted = true
iops = null
}]
}

variable "ami_filter" {
Expand Down Expand Up @@ -390,9 +397,9 @@ variable "instance_max_spot_price" {
}

variable "volume_size" {
description = "Size of runner volume"
description = "(Deprecaated, use block_device_mappings. Size of runner volume, if set it overrides the value provide via block_device_mappings."
type = number
default = 30
default = null
}

variable "instance_type" {
Expand Down

0 comments on commit 4e803b2

Please sign in to comment.