This repository has been archived by the owner on Sep 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
master.tf
58 lines (51 loc) · 1.81 KB
/
master.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
49
50
51
52
53
54
55
56
57
58
resource "google_compute_instance" "mesos-master" {
count = "${var.masters}"
name = "${var.name}-mesos-master-${count.index}"
machine_type = "${var.master_machine_type}"
zone = "${var.zone}"
tags = ["mesos-master","http","https","ssh","vpn"]
disk {
image = "${var.image}"
type = "pd-ssd"
}
# declare metadata for configuration of the node
metadata {
mastercount = "${var.masters}"
clustername = "${var.name}"
myid = "${count.index}"
domain = "${var.domain}"
subnetwork = "${var.subnetwork}"
mesosversion = "${var.mesos_version}"
}
service_account {
scopes = ["userinfo-email", "compute-ro", "storage-ro"]
}
# network interface
network_interface {
subnetwork = "${google_compute_subnetwork.mesos-net.name}"
access_config {
// ephemeral address
}
}
# define default connection for remote provisioners
connection {
type = "ssh"
user = "${var.gce_ssh_user}"
private_key = "${file(var.gce_ssh_private_key_file)}"
}
# install mesos, haproxy, docker, openvpn, and configure the node
provisioner "remote-exec" {
scripts = [
"${path.module}/scripts/common_install_${var.distribution}.sh",
"${path.module}/scripts/mesos_install_${var.distribution}.sh",
"${path.module}/scripts/master_install_${var.distribution}.sh",
"${path.module}/scripts/openvpn_install_${var.distribution}.sh",
"${path.module}/scripts/haproxy_install.sh",
"${path.module}/scripts/common_config.sh",
"${path.module}/scripts/master_config.sh"
]
}
}
output "openvpn" {
value = "${var.gce_ssh_user}@${google_compute_instance.mesos-master.0.network_interface.0.access_config.0.assigned_nat_ip}:/home/${var.gce_ssh_user}/openvpn/client.ovpn"
}