diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d74d3b..a01afe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ project adheres to [Semantic Versioning](http://semver.org/). ### Added -- A useful addition (slam dunk, @self 🔥) +- add spot_price option to aws_launch_configuration ### Changed diff --git a/variables.tf b/variables.tf index 60e3b89..6618fdf 100644 --- a/variables.tf +++ b/variables.tf @@ -86,6 +86,7 @@ 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. + spot_price = "" # Cost of spot instance. 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". diff --git a/workers.tf b/workers.tf index d6624e9..e7fa0f0 100644 --- a/workers.tf +++ b/workers.tf @@ -30,6 +30,7 @@ resource "aws_launch_configuration" "workers" { key_name = "${lookup(var.worker_groups[count.index], "key_name", lookup(var.workers_group_defaults, "key_name"))}" user_data_base64 = "${base64encode(element(data.template_file.userdata.*.rendered, count.index))}" ebs_optimized = "${lookup(var.worker_groups[count.index], "ebs_optimized", lookup(local.ebs_optimized, lookup(var.worker_groups[count.index], "instance_type", lookup(var.workers_group_defaults, "instance_type")), false))}" + spot_price = "${lookup(var.worker_groups[count.index], "spot_price", lookup(var.workers_group_defaults, "spot_price"))}" count = "${var.worker_group_count}" lifecycle {