-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
28 lines (24 loc) · 966 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
data "template_file" "init" {
template = "${file("${path.module}/templates/userdata.sh.${var.os_version}.tpl")}"
vars = {
count = "${var.count}"
project_id = "${var.project_id}"
packet_token = "${var.packet_token}"
facility = "${var.facility}"
backend_tag = "${var.backend_tag}"
log_driver = "${var.log_driver}"
log_driver_opts = "${jsonencode(var.log_driver_opts)}"
lets_encrypt_email = "${var.lets_encrypt_email}"
}
}
resource "packet_device" "traefik-lb" {
count = "${var.count}"
hostname = "${var.hostname != "" ? "${var.hostname}" : "prod-${format("traefik-%03d", count.index + 1)}" }"
plan = "${var.plan}"
facility = "${var.facility}"
operating_system = "${var.os_version}"
billing_cycle = "hourly"
project_id = "${var.project_id}"
tags = ["traefik-lb"]
user_data = "${data.template_file.init.rendered}"
}