open-nomad/demo/digitalocean/terraform/statsite/main.tf
2023-04-10 15:36:59 +00:00

30 lines
742 B
HCL

# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
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}"
name = "nomad-statsite-${var.region}-${count.index}"
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"
}