2019-07-29 02:35:57 +00:00
|
|
|
/* PROVIDERS ------------------------------------*/
|
|
|
|
|
2019-03-20 12:35:10 +00:00
|
|
|
provider "digitalocean" {
|
2019-07-29 02:35:57 +00:00
|
|
|
token = var.digitalocean_token
|
2019-03-20 12:35:10 +00:00
|
|
|
}
|
2019-07-29 02:35:57 +00:00
|
|
|
|
2019-03-20 12:35:10 +00:00
|
|
|
provider "cloudflare" {
|
2019-07-29 02:35:57 +00:00
|
|
|
email = var.cloudflare_email
|
|
|
|
token = var.cloudflare_token
|
|
|
|
org_id = var.cloudflare_org_id
|
2019-03-20 12:35:10 +00:00
|
|
|
}
|
2019-07-29 02:35:57 +00:00
|
|
|
|
2019-03-20 12:35:10 +00:00
|
|
|
provider "google" {
|
2019-07-29 02:35:57 +00:00
|
|
|
credentials = file("google-cloud.json")
|
2019-03-20 12:35:10 +00:00
|
|
|
project = "russia-servers"
|
|
|
|
region = "us-central1"
|
|
|
|
}
|
2019-07-29 02:35:57 +00:00
|
|
|
|
2019-03-20 12:35:10 +00:00
|
|
|
provider "alicloud" {
|
2019-07-29 02:35:57 +00:00
|
|
|
access_key = var.alicloud_access_key
|
|
|
|
secret_key = var.alicloud_secret_key
|
|
|
|
region = var.alicloud_region
|
2019-03-20 12:35:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* DATA -----------------------------------------*/
|
|
|
|
|
|
|
|
terraform {
|
|
|
|
backend "consul" {
|
2019-07-29 02:35:57 +00:00
|
|
|
address = "https://consul.statusim.net:8400"
|
|
|
|
lock = true
|
|
|
|
|
2019-03-20 12:35:10 +00:00
|
|
|
/* KV store has a limit of 512KB */
|
2019-07-29 02:35:57 +00:00
|
|
|
gzip = true
|
|
|
|
|
2019-03-20 12:35:10 +00:00
|
|
|
/* WARNING This needs to be changed for every repo. */
|
|
|
|
path = "terraform/nimbus/"
|
|
|
|
ca_file = "ansible/files/consul-ca.crt"
|
|
|
|
cert_file = "ansible/files/consul-client.crt"
|
|
|
|
key_file = "ansible/files/consul-client.key"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* RESOURCES ------------------------------------*/
|
|
|
|
|
2019-03-21 12:27:16 +00:00
|
|
|
module "nimbus-master" {
|
2019-07-29 02:35:57 +00:00
|
|
|
source = "github.com/status-im/infra-tf-digital-ocean"
|
|
|
|
|
|
|
|
name = "master"
|
|
|
|
env = "nimbus"
|
|
|
|
group = "nimbus-master"
|
|
|
|
size = "s-4vcpu-8gb"
|
|
|
|
host_count = 1
|
|
|
|
domain = var.domain
|
2019-03-21 12:27:16 +00:00
|
|
|
open_ports = [
|
2019-07-29 02:35:57 +00:00
|
|
|
"80", /* HTTP */
|
|
|
|
"443", /* HTTPS */
|
2019-04-18 09:33:09 +00:00
|
|
|
"9000-9010", /* Nimbus ports */
|
|
|
|
"9100-9110", /* Nimbus ports */
|
2019-03-21 12:27:16 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2019-07-29 02:35:57 +00:00
|
|
|
module "nimbus-nodes" {
|
|
|
|
source = "github.com/status-im/infra-tf-digital-ocean"
|
|
|
|
|
|
|
|
name = "node"
|
|
|
|
env = "nimbus"
|
|
|
|
group = "nimbus-slaves"
|
|
|
|
size = "s-4vcpu-8gb"
|
|
|
|
domain = var.domain
|
|
|
|
host_count = var.hosts_count
|
|
|
|
open_ports = [
|
|
|
|
"80", /* HTTP */
|
|
|
|
"443", /* HTTPS */
|
|
|
|
"9000-9010", /* beacon node */
|
|
|
|
"9100-9110", /* beacon node */
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DNS ------------------------------------------*/
|
|
|
|
|
2019-04-17 17:25:11 +00:00
|
|
|
resource "cloudflare_record" "nimbus-test-stats" {
|
2019-07-29 02:35:57 +00:00
|
|
|
domain = var.public_domain
|
2019-04-17 17:25:11 +00:00
|
|
|
name = "nimbus-test-stats"
|
|
|
|
type = "A"
|
|
|
|
proxied = true
|
2019-07-29 02:35:57 +00:00
|
|
|
value = module.nimbus-master.public_ips[count.index]
|
|
|
|
count = length(module.nimbus-master.public_ips)
|
2019-04-17 17:25:11 +00:00
|
|
|
}
|
|
|
|
|
2019-03-21 12:27:16 +00:00
|
|
|
resource "cloudflare_record" "serenity-testnets" {
|
2019-07-29 02:35:57 +00:00
|
|
|
domain = var.public_domain
|
2019-03-21 12:27:16 +00:00
|
|
|
name = "serenity-testnets"
|
|
|
|
type = "A"
|
|
|
|
proxied = true
|
2019-07-29 02:35:57 +00:00
|
|
|
value = module.nimbus-master.public_ips[count.index]
|
|
|
|
count = length(module.nimbus-master.public_ips)
|
2019-03-21 12:27:16 +00:00
|
|
|
}
|
|
|
|
|