infra-faucet/main.tf

75 lines
2.0 KiB
HCL

/* 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" {
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}"
open_ports = [
"80-80", /* HTTP */
"443-443", /* HTTPS */
"30303" /* GETH */
]
}
resource "cloudflare_record" "api" {
domain = "${var.public_domain}"
name = "faucet-${terraform.workspace}"
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"
count = "${local.ws["miner_count"]}"
type = "${local.ws["miner_instance_type"]}"
vol_size = "${local.ws["miner_volume_size"]}"
domain = "${var.domain}"
open_ports = [
"30303" /* GETH */
]
}