Skip to content

Commit 40f2642

Browse files
committed
Add termination_time* support for spot instances
1 parent ddc5eb8 commit 40f2642

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

hosts.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,8 @@ locals {
3333
concat(null_resource.controller.*.triggers.hostname_prefix,
3434
null_resource.worker.*.triggers.hostname_prefix),
3535
local.hostnames)}"
36+
termination_timestamps = "${compact(concat(packet_device.controller.*.termination_timestamp,
37+
packet_device.worker.*.termination_timestamp))}"
38+
termination_time_remainings = "${compact(concat(packet_device.controller.*.termination_time_remaining,
39+
packet_device.worker.*.termination_time_remaining))}"
3640
}

nodes.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "packet_device" "controller" {
1717
always_pxe = "${var.always_pxe}"
1818
spot_instance = "${var.spot_instance}"
1919
spot_price_max = "${var.spot_price_max}"
20-
/* termination_time = "${var.termination_time}" */
20+
termination_time = "${var.termination_time}"
2121
}
2222

2323
resource "packet_device" "worker" {
@@ -35,7 +35,7 @@ resource "packet_device" "worker" {
3535
always_pxe = "${var.always_pxe}"
3636
spot_instance = "${var.spot_instance}"
3737
spot_price_max = "${var.spot_price_max}"
38-
/* termination_time = "${var.termination_time}" */
38+
termination_time = "${var.termination_time}"
3939
}
4040

4141
resource "packet_ssh_key" "ssh" {

outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,11 @@ output "kube_version_patch" {
2525
output "hosts_file_entries" {
2626
value = "${join("\n",local.hosts_entries)}"
2727
}
28+
29+
output "termination_timestamp" {
30+
value = "${local.termination_timestamps}"
31+
}
32+
33+
output "termination_time_remaining" {
34+
value = "${local.termination_time_remainings}"
35+
}

variables.tf

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,19 @@ variable "project_id" {
1414
variable "spot_instance" {
1515
description = "Set to true to create a spot instance. See: https://help.packet.net/technical/deployment-options/spot-market"
1616
type = "string"
17-
default = "false"
1817
}
1918

2019
variable "spot_price_max" {
2120
description = "The bid price for your spot_instance."
2221
type = "string"
22+
}
23+
24+
variable "termination_time" {
25+
description = "A predetermined time to delete your spot_instance. Takes RFC3339 (e.g. \"2018-09-21T19:20:01-05:00\") or duration (e.g. \"6h20m\") formats."
26+
type = "string"
2327
default = ""
2428
}
2529

26-
# variable "termination_time" {
27-
# description = "A predetermined time to delete your spot_instance."
28-
# type = "string"
29-
# default = ""
30-
# }
3130

3231
## Machine
3332
variable operating_system {
@@ -91,7 +90,7 @@ variable etcd_servers {
9190
}
9291

9392
variable experimental_self_hosted_etcd {
94-
default = true
93+
default = false
9594
}
9695

9796
## Customize Kubernetes components/addons
@@ -108,7 +107,3 @@ variable kube_router {
108107
network_policy = true
109108
}
110109
}
111-
112-
variable use_prometheus {
113-
default = true
114-
}

0 commit comments

Comments
 (0)