From 8d4a8a66950c1a25d81fad15574ef7a765187214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 17 Nov 2020 11:33:26 +0100 Subject: [PATCH] split Terraform resources into dedicated files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- common.tf | 18 +++++++++++++++ dns.tf | 17 ++++++++++++++ nimbus.tf | 69 ------------------------------------------------------- toledo.tf | 25 ++++++++++++++++++++ 4 files changed, 60 insertions(+), 69 deletions(-) create mode 100644 common.tf create mode 100644 dns.tf create mode 100644 toledo.tf diff --git a/common.tf b/common.tf new file mode 100644 index 0000000..ab2b4d4 --- /dev/null +++ b/common.tf @@ -0,0 +1,18 @@ +locals { + nimbus_ports = [ + "9000-9010", /* Nimbus ports */ + "9100-9110", /* Nimbus ports */ + ] +} + +module "nimbus_network" { + source = "github.com/status-im/infra-tf-aws-vpc" + + name = "nimbus" + stage = "test" + zones = [ "eu-central-1a" ] + + /* Firewall */ + open_udp_ports = local.nimbus_ports + open_tcp_ports = concat(local.nimbus_ports, [ "22", "80", "443" ]) +} diff --git a/dns.tf b/dns.tf new file mode 100644 index 0000000..64a3f4f --- /dev/null +++ b/dns.tf @@ -0,0 +1,17 @@ +resource "cloudflare_record" "nimbus_test_stats" { + zone_id = local.zones["status.im"] + name = "nimbus-test-stats" + type = "A" + proxied = true + value = module.nimbus_master.public_ips[count.index] + count = length(module.nimbus_master.public_ips) +} + +resource "cloudflare_record" "serenity_testnets" { + zone_id = local.zones["status.im"] + name = "serenity-testnets" + type = "A" + proxied = true + value = module.nimbus_master.public_ips[count.index] + count = length(module.nimbus_master.public_ips) +} diff --git a/nimbus.tf b/nimbus.tf index 6999eae..457efe1 100644 --- a/nimbus.tf +++ b/nimbus.tf @@ -1,26 +1,3 @@ -/* NETWORK --------------------------------------*/ - -locals { - nimbus_ports = [ - "9000-9010", /* Nimbus ports */ - "9100-9110", /* Nimbus ports */ - ] -} - -module "nimbus_network" { - source = "github.com/status-im/infra-tf-aws-vpc" - - name = "nimbus" - stage = "test" - zones = [ "eu-central-1a" ] - - /* Firewall */ - open_udp_ports = local.nimbus_ports - open_tcp_ports = concat(local.nimbus_ports, [ "22", "80", "443" ]) -} - -/* HOSTS ----------------------------------------*/ - module "nimbus_master" { source = "github.com/status-im/infra-tf-amazon-web-services" @@ -72,49 +49,3 @@ module "nimbus_nodes" { secgroup_id = module.nimbus_network.secgroup.id keypair_name = aws_key_pair.jakubgs.key_name } - -module "nimbus_nodes_toledo" { - source = "github.com/status-im/infra-tf-amazon-web-services" - - name = "toledo" - env = "nimbus" - group = "nimbus-slaves-toledo" - domain = var.domain - - /* Scaling */ - instance_type = "t3a.medium" - root_vol_size = 20 - data_vol_size = 150 - data_vol_type = "gp2" - host_count = 2 - - /* Firewall */ - open_udp_ports = local.nimbus_ports - open_tcp_ports = local.nimbus_ports - - /* Plumbing */ - vpc_id = module.nimbus_network.vpc.id - subnet_id = module.nimbus_network.subnets[0].id - secgroup_id = module.nimbus_network.secgroup.id - keypair_name = aws_key_pair.jakubgs.key_name -} - -/* DNS ------------------------------------------*/ - -resource "cloudflare_record" "nimbus_test_stats" { - zone_id = local.zones["status.im"] - name = "nimbus-test-stats" - type = "A" - proxied = true - value = module.nimbus_master.public_ips[count.index] - count = length(module.nimbus_master.public_ips) -} - -resource "cloudflare_record" "serenity_testnets" { - zone_id = local.zones["status.im"] - name = "serenity-testnets" - type = "A" - proxied = true - value = module.nimbus_master.public_ips[count.index] - count = length(module.nimbus_master.public_ips) -} diff --git a/toledo.tf b/toledo.tf new file mode 100644 index 0000000..e6a1eff --- /dev/null +++ b/toledo.tf @@ -0,0 +1,25 @@ +module "nimbus_nodes_toledo" { + source = "github.com/status-im/infra-tf-amazon-web-services" + + name = "toledo" + env = "nimbus" + group = "nimbus-slaves-toledo" + domain = var.domain + + /* Scaling */ + instance_type = "t3a.medium" + root_vol_size = 20 + data_vol_size = 150 + data_vol_type = "gp2" + host_count = 2 + + /* Firewall */ + open_udp_ports = local.nimbus_ports + open_tcp_ports = local.nimbus_ports + + /* Plumbing */ + vpc_id = module.nimbus_network.vpc.id + subnet_id = module.nimbus_network.subnets[0].id + secgroup_id = module.nimbus_network.secgroup.id + keypair_name = aws_key_pair.jakubgs.key_name +}