2019-03-18 15:29:44 +00:00
|
|
|
/* DERIVED --------------------------------------*/
|
|
|
|
provider "cloudflare" {
|
|
|
|
email = "${var.cloudflare_email}"
|
|
|
|
token = "${var.cloudflare_token}"
|
|
|
|
org_id = "${var.cloudflare_org_id}"
|
|
|
|
}
|
|
|
|
provider "google" {
|
|
|
|
credentials = "${file("google-cloud.json")}"
|
|
|
|
project = "russia-servers"
|
|
|
|
region = "us-central1"
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DATA -----------------------------------------*/
|
|
|
|
|
|
|
|
terraform {
|
|
|
|
backend "consul" {
|
|
|
|
address = "https://consul.statusim.net:8400"
|
|
|
|
lock = true
|
|
|
|
/* KV store has a limit of 512KB */
|
|
|
|
gzip = true
|
|
|
|
/* WARNING This needs to be changed for every repo. */
|
|
|
|
path = "terraform/faucet/"
|
|
|
|
ca_file = "ansible/files/consul-ca.crt"
|
|
|
|
cert_file = "ansible/files/consul-client.crt"
|
|
|
|
key_file = "ansible/files/consul-client.key"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* WORKSPACES -----------------------------------*/
|
|
|
|
|
|
|
|
locals {
|
|
|
|
ws = "${merge(local.env["defaults"], local.env[terraform.workspace])}"
|
|
|
|
}
|
|
|
|
|
|
|
|
/* RESOURCES ------------------------------------*/
|
|
|
|
|
|
|
|
module "faucet-master" {
|
2019-04-16 16:37:27 +00:00
|
|
|
source = "github.com/status-im/infra-tf-google-cloud"
|
|
|
|
name = "master"
|
|
|
|
env = "faucet"
|
|
|
|
group = "faucet-master"
|
|
|
|
type = "n1-standard-1"
|
|
|
|
vol_size = "${local.ws["miner_volume_size"]}"
|
|
|
|
count = 1
|
|
|
|
domain = "${var.domain}"
|
2019-03-18 15:29:44 +00:00
|
|
|
open_ports = [
|
|
|
|
"80-80", /* HTTP */
|
|
|
|
"443-443", /* HTTPS */
|
2019-03-19 19:26:12 +00:00
|
|
|
"30303" /* GETH */
|
2019-03-18 15:29:44 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "cloudflare_record" "api" {
|
|
|
|
domain = "${var.public_domain}"
|
2019-03-19 12:48:04 +00:00
|
|
|
name = "faucet-${terraform.workspace}"
|
2019-03-18 15:29:44 +00:00
|
|
|
value = "${module.faucet-master.public_ips[0]}"
|
|
|
|
type = "A"
|
|
|
|
proxied = true
|
|
|
|
}
|
|
|
|
|
|
|
|
/* MINERS ---------------------------------------*/
|
|
|
|
|
|
|
|
module "faucet-miners" {
|
|
|
|
source = "github.com/status-im/infra-tf-google-cloud"
|
|
|
|
name = "miner"
|
|
|
|
env = "faucet"
|
|
|
|
group = "faucet-miners"
|
2019-03-18 15:45:07 +00:00
|
|
|
count = "${local.ws["miner_count"]}"
|
|
|
|
type = "${local.ws["miner_instance_type"]}"
|
2019-03-18 15:29:44 +00:00
|
|
|
vol_size = "${local.ws["miner_volume_size"]}"
|
|
|
|
domain = "${var.domain}"
|
|
|
|
open_ports = [
|
|
|
|
"30303" /* GETH */
|
|
|
|
]
|
|
|
|
}
|