demo/digitalocean: add Atlas for Terraform

This commit is contained in:
Ryan Uber 2015-09-24 10:50:41 -07:00
parent f3f3b1f505
commit 688541e6b3
3 changed files with 16 additions and 11 deletions

View File

@ -1,11 +1,15 @@
variable "image" {}
variable "ssh_keys" {}
resource "atlas_artifact" "nomad-digitalocean" {
name = "hashicorp/nomad-demo"
type = "digitalocean.image"
version = "latest"
}
module "servers" {
source = "./server"
region = "nyc3"
count = 3
image = "${var.image}"
image = "${atlas_artifact.nomad-digitalocean.id}"
ssh_keys = "${var.ssh_keys}"
}
@ -13,7 +17,7 @@ module "clients-nyc3" {
source = "./client"
region = "nyc3"
count = 1
image = "${var.image}"
image = "${atlas_artifact.nomad-digitalocean.id}"
servers = "${module.servers.addrs}"
ssh_keys = "${var.ssh_keys}"
}
@ -23,7 +27,7 @@ module "clients-ams2" {
source = "./client"
region = "ams2"
count = 1
image = "${var.image}"
image = "${atlas_artifact.nomad-digitalocean.id}"
servers = "${module.servers.addrs}"
ssh_keys = "${var.ssh_keys}"
}
@ -32,7 +36,7 @@ module "clients-ams3" {
source = "./client"
region = "ams3"
count = 1
image = "${var.image}"
image = "${atlas_artifact.nomad-digitalocean.id}"
servers = "${module.servers.addrs}"
ssh_keys = "${var.ssh_keys}"
}
@ -41,7 +45,7 @@ module "clients-sfo1" {
source = "./client"
region = "sfo1"
count = 1
image = "${var.image}"
image = "${atlas_artifact.nomad-digitalocean.id}"
servers = "${module.servers.addrs}"
ssh_keys = "${var.ssh_keys}"
}

View File

@ -1,4 +1,3 @@
variable "count" {}
variable "image" {}
variable "region" {}
variable "size" { default = "512mb" }
@ -7,7 +6,7 @@ variable "ssh_keys" {}
resource "digitalocean_droplet" "server" {
image = "${var.image}"
name = "server-${var.region}-${count.index}"
count = "${var.count}"
count = 3
size = "${var.size}"
region = "${var.region}"
ssh_keys = ["${split(",", var.ssh_keys)}"]

View File

@ -1,2 +1,4 @@
image = "13674033"
ssh_keys = "1494275"
# This is a comma-separated list of SSH key ID's or fingerprints
# available in your DigitalOcean account. These keys will be granted
# SSH access to all of the deployed instances.
ssh_keys = "ef:7f:3d:c1:76:12:35:e8:ea:d4:17:3d:83:46:59:7c"