From 0bc357af260c8c6aa987a7ada816fe71634a2944 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Fri, 13 Jul 2018 12:30:53 +0000 Subject: [PATCH] #57 - manage root volume size and type --- variables.tf | 3 +++ workers.tf | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/variables.tf b/variables.tf index c73ae3c..91af839 100644 --- a/variables.tf +++ b/variables.tf @@ -76,6 +76,9 @@ variable "workers_group_defaults" { asg_max_size = "3" # Maximum worker capacity in the autoscaling group. asg_min_size = "1" # Minimum worker capacity in the autoscaling group. instance_type = "m4.large" # Size of the workers instances. + root_volume_size = "20" # root volume size of workers instances. + root_volume_type = "gp2" # root volume type of workers instances, can be 'standard', 'gp2', or 'io1' + root_iops = "0" # The amount of provisioned IOPS. This must be set with a volume_type of "io1". key_name = "" # The key name that should be used for the instances in the autoscaling group pre_userdata = "" # userdata to pre-append to the default userdata. additional_userdata = "" # userdata to append to the default userdata. diff --git a/workers.tf b/workers.tf index 2d55ae2..da221b3 100644 --- a/workers.tf +++ b/workers.tf @@ -37,9 +37,9 @@ resource "aws_launch_configuration" "workers" { } root_block_device { - volume_size = "${var.root_volume_size}" - volume_type = "${var.root_volume_type}" - iops = "${var.root_iops}" + volume_size = "${lookup(var.worker_groups[count.index], "root_volume_size", lookup(var.workers_group_defaults, "root_volume_size"))}" + volume_type = "${lookup(var.worker_groups[count.index], "root_volume_type", lookup(var.workers_group_defaults, "root_volume_type"))}" + iops = "${lookup(var.worker_groups[count.index], "root_iops", lookup(var.workers_group_defaults, "root_iops"))}" delete_on_termination = true } }