Skip to content

Commit

Permalink
refactor!: use optional in variable block_device_mappings (#2664)
Browse files Browse the repository at this point in the history
refactor: use optiona for variable block_device_mappings
  • Loading branch information
jpalomaki authored and npalm committed Dec 28, 2022
1 parent 086a2e1 commit 08c484c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 34 deletions.
26 changes: 9 additions & 17 deletions modules/runners/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,18 @@ variable "s3_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`, `throughput`, `kms_key_id`, `snapshot_id`."
type = list(object({
delete_on_termination = bool
device_name = string
encrypted = bool
iops = number
kms_key_id = string
snapshot_id = string
throughput = number
delete_on_termination = optional(bool, true)
device_name = optional(string, "/dev/xvda")
encrypted = optional(bool, true)
iops = optional(number)
kms_key_id = optional(string)
snapshot_id = optional(string)
throughput = optional(number)
volume_size = number
volume_type = string
volume_type = optional(string, "gp3")
}))
default = [{
delete_on_termination = true
device_name = "/dev/xvda"
encrypted = true
iops = null
kms_key_id = null
snapshot_id = null
throughput = null
volume_size = 30
volume_type = "gp3"
volume_size = 30
}]
}

Expand Down
26 changes: 9 additions & 17 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -274,26 +274,18 @@ 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`, `throughput`, `kms_key_id`, `snapshot_id`."
type = list(object({
delete_on_termination = bool
device_name = string
encrypted = bool
iops = number
kms_key_id = string
snapshot_id = string
throughput = number
delete_on_termination = optional(bool, true)
device_name = optional(string, "/dev/xvda")
encrypted = optional(bool, true)
iops = optional(number)
kms_key_id = optional(string)
snapshot_id = optional(string)
throughput = optional(number)
volume_size = number
volume_type = string
volume_type = optional(string, "gp3")
}))
default = [{
delete_on_termination = true
device_name = "/dev/xvda"
encrypted = true
iops = null
kms_key_id = null
snapshot_id = null
throughput = null
volume_size = 30
volume_type = "gp3"
volume_size = 30
}]
}

Expand Down

0 comments on commit 08c484c

Please sign in to comment.