feat: Add instance store volume option for instances with local disk (#1213)

This commit is contained in:
Jason Witkowski
2021-05-27 15:46:38 -04:00
committed by GitHub
parent 9571a19028
commit 6aac9c4961
2 changed files with 60 additions and 45 deletions

View File

@@ -37,15 +37,16 @@ locals {
asg_max_size = "3" # Maximum worker capacity in the autoscaling group.
asg_min_size = "1" # Minimum worker capacity in the autoscaling group. NOTE: Change in this paramater will affect the asg_desired_capacity, like changing its value to 2 will change asg_desired_capacity value to 2 but bringing back it to 1 will not affect the asg_desired_capacity.
asg_force_delete = false # Enable forced deletion for the autoscaling group.
asg_initial_lifecycle_hooks = [] # Initial lifecycle hook for the autoscaling group.
asg_initial_lifecycle_hooks = [] # Initital lifecycle hook for the autoscaling group.
default_cooldown = null # The amount of time, in seconds, after a scaling activity completes before another scaling activity can start.
health_check_type = null # Controls how health checking is done. Valid values are "EC2" or "ELB".
health_check_grace_period = null # Time in seconds after instance comes into service before checking health.
instance_type = "m4.large" # Size of the workers instances.
instance_store_virtual_name = "ephemeral0" # "virtual_name" of the instance store volume.
spot_price = "" # Cost of spot instance.
placement_tenancy = "" # The tenancy of the instance. Valid values are "default" or "dedicated".
root_volume_size = "100" # root volume size of workers instances.
root_volume_type = "gp2" # root volume type of workers instances, can be 'standard', 'gp3' (for Launch Template), 'gp2', or 'io1'
root_volume_type = "gp3" # root volume type of workers instances, can be "standard", "gp3", "gp2", or "io1"
root_iops = "0" # The amount of provisioned IOPS. This must be set with a volume_type of "io1".
root_volume_throughput = null # The amount of throughput to provision for a gp3 volume.
key_name = "" # The key pair name that should be used for the instances in the autoscaling group
@@ -73,7 +74,9 @@ locals {
termination_policies = [] # A list of policies to decide how the instances in the auto scale group should be terminated.
platform = "linux" # Platform of workers. either "linux" or "windows"
additional_ebs_volumes = [] # A list of additional volumes to be attached to the instances on this Auto Scaling group. Each volume should be an object with the following: block_device_name (required), volume_size, volume_type, iops, encrypted, kms_key_id (only on launch-template), delete_on_termination. Optional values are grabbed from root volume or from defaults
additional_instance_store_volumes = [] # A list of additional instance store (local disk) volumes to be attached to the instances on this Auto Scaling group. Each volume should be an object with the following: block_device_name (required), virtual_name.
warm_pool = null # If this block is configured, add a Warm Pool to the specified Auto Scaling group.
# Settings for launch templates
root_block_device_name = concat(data.aws_ami.eks_worker.*.root_device_name, [""])[0] # Root device name for workers. If non is provided, will assume default AMI was used.
root_kms_key_id = "" # The KMS key to use when encrypting the root storage device

View File

@@ -518,6 +518,18 @@ resource "aws_launch_template" "workers_launch_template" {
}
dynamic "block_device_mappings" {
for_each = lookup(var.worker_groups_launch_template[count.index], "additional_instance_store_volumes", local.workers_group_defaults["additional_instance_store_volumes"])
content {
device_name = block_device_mappings.value.block_device_name
virtual_name = lookup(
block_device_mappings.value,
"virtual_name",
local.workers_group_defaults["instance_store_virtual_name"],
)
}
}
tag_specifications {
resource_type = "volume"