split Terraform resources into dedicated files

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-11-17 11:33:26 +01:00
parent 81857071de
commit 8d4a8a6695
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
4 changed files with 60 additions and 69 deletions

18
common.tf Normal file
View File

@ -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" ])
}

17
dns.tf Normal file
View File

@ -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)
}

View File

@ -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)
}

25
toledo.tf Normal file
View File

@ -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
}