-
Notifications
You must be signed in to change notification settings - Fork 4
/
resources.tf
48 lines (39 loc) · 928 Bytes
/
resources.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
variable "public_key" {}
variable "project" {}
variable "image" {
default = "ubuntu-14-04-x64"
}
variable "size" {
default = "4gb"
}
resource "digitalocean_droplet" "node" {
count = "2"
image = "${var.image}"
name = "${var.project}-minio-ha-${count.index+1}"
region = "${var.region}"
size = "${var.size}"
private_networking = true
ssh_keys = [
"${var.ssh_fingerprint}"
]
user_data = "${template_file.user_data.rendered}"
connection {
user = "root"
type = "ssh"
key_file = "${var.private_key_path}"
timeout = "2m"
}
provisioner "remote-exec" {
inline = [ "# droplet up" ]
}
}
resource "template_file" "user_data" {
template = "${file("${path.module}/conf/cloud-config.yaml")}"
vars {
public_key = "${var.public_key}"
}
}
resource "digitalocean_floating_ip" "fip" {
region = "${var.region}"
droplet_id = "${digitalocean_droplet.node.0.id}"
}