infra-faucet/main.tf

72 lines
1.7 KiB
Terraform
Raw Normal View History

/* 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"
}
}
/* RESOURCES ------------------------------------*/
module "main" {
source = "github.com/status-im/infra-tf-google-cloud"
name = "master"
env = "faucet"
group = "faucet-master"
type = "n1-standard-1"
count = 1
vol_size = 10
domain = "${var.domain}"
open_ports = [
"80-80", /* HTTP */
"443-443", /* HTTPS */
"30303" /* GETH */
]
}
/* DNS Entries for faucet APIs */
resource "cloudflare_record" "main-ropsten" {
domain = "${var.public_domain}"
name = "faucet-ropsten"
value = "${module.main.public_ips[0]}"
type = "A"
proxied = true
}
resource "cloudflare_record" "main-rinkeby" {
domain = "${var.public_domain}"
name = "faucet-rinkeby"
value = "${module.main.public_ips[0]}"
type = "A"
proxied = true
}
resource "cloudflare_record" "main-goerli" {
domain = "${var.public_domain}"
name = "faucet-goerli"
value = "${module.main.public_ips[0]}"
type = "A"
proxied = true
}