2015-09-24 19:26:17 +00:00
|
|
|
variable "size" { default = "1gb" }
|
|
|
|
variable "region" {}
|
|
|
|
variable "ssh_keys" {}
|
|
|
|
|
|
|
|
resource "atlas_artifact" "statsite-digitalocean" {
|
|
|
|
name = "hashicorp/nomad-demo-statsite"
|
|
|
|
type = "digitalocean.image"
|
|
|
|
version = "latest"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "digitalocean_droplet" "statsite" {
|
|
|
|
image = "${atlas_artifact.statsite-digitalocean.id}"
|
2015-09-24 19:35:35 +00:00
|
|
|
name = "nomad-statsite-${var.region}-${count.index}"
|
2015-09-24 19:26:17 +00:00
|
|
|
count = 1
|
|
|
|
size = "${var.size}"
|
|
|
|
region = "${var.region}"
|
|
|
|
ssh_keys = ["${split(",", var.ssh_keys)}"]
|
|
|
|
|
|
|
|
provisioner "remote-exec" {
|
|
|
|
inline = "sudo start statsite || true"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
output "addr" {
|
|
|
|
value = "${digitalocean_droplet.statsite.ipv4_address}:8125"
|
|
|
|
}
|