mirror of
https://github.com/status-im/infra-swarm.git
synced 2025-02-21 20:08:22 +00:00
add basic main.tf and workpaces.tf
This commit is contained in:
parent
1f51df9315
commit
a4ea13c7c2
58
main.tf
Normal file
58
main.tf
Normal file
@ -0,0 +1,58 @@
|
||||
/* PROVIDERS --------------------------------------*/
|
||||
|
||||
provider "digitalocean" {
|
||||
token = "${var.digitalocean_token}"
|
||||
}
|
||||
provider "cloudflare" {
|
||||
email = "${var.cloudflare_email}"
|
||||
token = "${var.cloudflare_token}"
|
||||
}
|
||||
provider "google" {
|
||||
credentials = "${file("google-cloud.json")}"
|
||||
project = "russia-servers"
|
||||
region = "us-central1"
|
||||
}
|
||||
provider "alicloud" {
|
||||
access_key = "${var.alicloud_access_key}"
|
||||
secret_key = "${var.alicloud_secret_key}"
|
||||
region = "${var.alicloud_region}"
|
||||
}
|
||||
|
||||
/* BACKEND ----------------------------------------*/
|
||||
|
||||
terraform {
|
||||
backend "consul" {
|
||||
address = "https://consul.statusim.net:8400"
|
||||
lock = true
|
||||
/* WARNING This needs to be changed for every repo. */
|
||||
path = "terraform/swarm/"
|
||||
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 "swarm" {
|
||||
source = "modules/multi-provider"
|
||||
/* node type */
|
||||
name = "swarm"
|
||||
group = "swarm"
|
||||
/* scaling options */
|
||||
count = "${local.ws["hosts_count"]}"
|
||||
/* general */
|
||||
env = "${var.env}"
|
||||
domain = "${var.domain}"
|
||||
eth_network = "${var.eth_network}"
|
||||
/* firewall */
|
||||
open_ports = [
|
||||
"30404-30410", /* discovery */
|
||||
]
|
||||
}
|
20
workspaces.tf
Normal file
20
workspaces.tf
Normal file
@ -0,0 +1,20 @@
|
||||
/* WORKSPACES ---------------------------------------------*/
|
||||
/**
|
||||
* This is a hacky way of binding specific variable
|
||||
* values to different Terraform workspaces.
|
||||
*
|
||||
* Details:
|
||||
* https://github.com/hashicorp/terraform/issues/15966
|
||||
*/
|
||||
|
||||
locals {
|
||||
env = {
|
||||
defaults = {
|
||||
hosts_count = 1
|
||||
}
|
||||
|
||||
# For testing infra changes before rollout to other fleets
|
||||
test = {}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------*/
|
Loading…
x
Reference in New Issue
Block a user