forked from groovemonkey/digitalocean-terraform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
haproxy-web.tf
33 lines (33 loc) · 832 Bytes
/
haproxy-web.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
29
30
31
32
33
resource "digitalocean_droplet" "haproxy-web" {
image = "ubuntu-16-04-x64"
name = "haproxy-web"
region = "nyc2"
size = "512mb"
private_networking = true
ssh_keys = [
"${var.ssh_fingerprint}"
]
connection {
host = "${digitalocean_droplet.haproxy-web}"
user = "root"
type = "ssh"
private_key = "${file(var.pvt_key)}"
timeout = "2m"
}
provisioner "remote-exec" {
inline = [
"sleep 25",
"sudo apt-get update",
"sudo apt-get -y install haproxy"
]
}
provisioner "file" {
content = "${data.template_file.haproxyconf.rendered}"
destination = "/etc/haproxy/haproxy.cfg"
}
provisioner "remote-exec" {
inline = [
"sudo service haproxy restart"
]
}
}