demo/digitalocean: fix terraform for ssh keys
This commit is contained in:
parent
98860f69f4
commit
c6d9652c09
|
@ -3,6 +3,7 @@ variable "image" {}
|
|||
variable "region" {}
|
||||
variable "size" { default = "512mb" }
|
||||
variable "servers" {}
|
||||
variable "ssh_keys" {}
|
||||
|
||||
resource "template_file" "client_config" {
|
||||
filename = "templates/client.hcl.tpl"
|
||||
|
@ -18,6 +19,7 @@ resource "digitalocean_droplet" "client" {
|
|||
count = "${var.count}"
|
||||
size = "${var.size}"
|
||||
region = "${var.region}"
|
||||
ssh_keys = ["${split(",", var.ssh_keys)}"]
|
||||
|
||||
provisioner "file" {
|
||||
source = "${template_file.client_config.filename}"
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
variable "image" { default = "nomad-1443043155" }
|
||||
variable "image" {}
|
||||
variable "ssh_keys" {}
|
||||
|
||||
module "servers" {
|
||||
source = "./server"
|
||||
region = "nyc3"
|
||||
count = 3
|
||||
image = "${var.image}"
|
||||
ssh_keys = "${var.ssh_keys}"
|
||||
}
|
||||
|
||||
module "clients-ams2" {
|
||||
|
@ -13,6 +15,7 @@ module "clients-ams2" {
|
|||
count = 1
|
||||
image = "${var.image}"
|
||||
servers = "${module.servers.addrs}"
|
||||
ssh_keys = "${var.ssh_keys}"
|
||||
}
|
||||
|
||||
module "clients-ams3" {
|
||||
|
@ -21,6 +24,7 @@ module "clients-ams3" {
|
|||
count = 1
|
||||
image = "${var.image}"
|
||||
servers = "${module.servers.addrs}"
|
||||
ssh_keys = "${var.ssh_keys}"
|
||||
}
|
||||
|
||||
module "clients-nyc3" {
|
||||
|
@ -29,6 +33,7 @@ module "clients-nyc3" {
|
|||
count = 1
|
||||
image = "${var.image}"
|
||||
servers = "${module.servers.addrs}"
|
||||
ssh_keys = "${var.ssh_keys}"
|
||||
}
|
||||
|
||||
module "clients-sfo1" {
|
||||
|
@ -37,4 +42,5 @@ module "clients-sfo1" {
|
|||
count = 1
|
||||
image = "${var.image}"
|
||||
servers = "${module.servers.addrs}"
|
||||
ssh_keys = "${var.ssh_keys}"
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ variable "count" {}
|
|||
variable "image" {}
|
||||
variable "region" {}
|
||||
variable "size" { default = "512mb" }
|
||||
variable "ssh_keys" {}
|
||||
|
||||
resource "template_file" "server_config" {
|
||||
filename = "templates/server.hcl.tpl"
|
||||
|
@ -16,6 +17,7 @@ resource "digitalocean_droplet" "server" {
|
|||
count = "${var.count}"
|
||||
size = "${var.size}"
|
||||
region = "${var.region}"
|
||||
ssh_keys = ["${split(",", var.ssh_keys)}"]
|
||||
|
||||
provisioner "file" {
|
||||
source = "${template_file.server_config.filename}"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
datacenter = "${var.datacenter}"
|
||||
datacenter = "${datacenter}"
|
||||
client {
|
||||
enabled = true
|
||||
servers = [ ${join(",", formatlist("\"%s:4647\"", var.servers))} ]
|
||||
servers = [ ${join(",", formatlist("\"%s:4647\"", servers))} ]
|
||||
node_class = "linux-64bit"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
datacenter = "${var.datacenter}"
|
||||
datacenter = "${datacenter}"
|
||||
server {
|
||||
enabled = true
|
||||
bootstrap_expect = 3
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
{
|
||||
"version": 1,
|
||||
"serial": 0,
|
||||
"modules": [
|
||||
{
|
||||
"path": [
|
||||
"root"
|
||||
],
|
||||
"outputs": {},
|
||||
"resources": {}
|
||||
},
|
||||
{
|
||||
"path": [
|
||||
"root",
|
||||
"clients-ams2"
|
||||
],
|
||||
"outputs": {},
|
||||
"resources": {}
|
||||
},
|
||||
{
|
||||
"path": [
|
||||
"root",
|
||||
"clients-ams3"
|
||||
],
|
||||
"outputs": {},
|
||||
"resources": {}
|
||||
},
|
||||
{
|
||||
"path": [
|
||||
"root",
|
||||
"clients-nyc3"
|
||||
],
|
||||
"outputs": {},
|
||||
"resources": {}
|
||||
},
|
||||
{
|
||||
"path": [
|
||||
"root",
|
||||
"clients-sfo1"
|
||||
],
|
||||
"outputs": {},
|
||||
"resources": {}
|
||||
},
|
||||
{
|
||||
"path": [
|
||||
"root",
|
||||
"servers"
|
||||
],
|
||||
"outputs": {},
|
||||
"resources": {}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,3 +1,2 @@
|
|||
image = "nomad-1443043155"
|
||||
client_size = "512mb"
|
||||
server_size = "512mb"
|
||||
image = "13671595"
|
||||
ssh_keys = "1494275"
|
||||
|
|
Loading…
Reference in a new issue