Skip to content

Commit bfdf538

Browse files
author
Steven Nemetz
committed
Add spot price support
1 parent b0c9b59 commit bfdf538

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

examples/ec2/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ module "example" {
9292
max_size = 1
9393
desired_capacity = 1
9494
wait_for_capacity_timeout = 0
95+
#spot_price = "0.5"
9596

9697
tags = {
9798
Project = "megasecret"

main.tf

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,24 @@ resource "aws_launch_configuration" "this" {
5959
count = "${module.enabled.value && var.launch_configuration == "" ? 1 : 0 }"
6060

6161
name_prefix = "${coalesce(var.lc_name, module.label.id)}-"
62-
image_id = "${var.image_id}"
63-
instance_type = "${var.instance_type}"
64-
iam_instance_profile = "${var.iam_instance_profile}"
65-
key_name = "${var.key_name}"
66-
security_groups = ["${var.security_groups}"]
6762
associate_public_ip_address = "${var.associate_public_ip_address}"
68-
user_data = "${var.user_data}"
69-
enable_monitoring = "${var.enable_monitoring}"
70-
placement_tenancy = "${var.placement_tenancy}"
7163
ebs_block_device = "${var.ebs_block_device}"
7264
ebs_optimized = "${var.ebs_optimized}"
65+
enable_monitoring = "${var.enable_monitoring}"
7366
ephemeral_block_device = "${var.ephemeral_block_device}"
67+
iam_instance_profile = "${var.iam_instance_profile}"
68+
image_id = "${var.image_id}"
69+
instance_type = "${var.instance_type}"
70+
key_name = "${var.key_name}"
71+
placement_tenancy = "${var.spot_price == "0" ? var.placement_tenancy : ""}"
7472
root_block_device = "${var.root_block_device}"
73+
security_groups = ["${var.security_groups}"]
74+
spot_price = "${var.spot_price == "0" ? "" : var.spot_price}"
75+
user_data = "${var.user_data}"
7576

7677
lifecycle {
7778
create_before_destroy = true
7879
}
79-
80-
#spot_price = "${var.spot_price == "0" ? "" : var.spot_price}"
81-
# spot_price = "${var.spot_price}" // placement_tenancy does not work with spot_price
8280
}
8381

8482
/*

0 commit comments

Comments
 (0)