forked from status-im/infra-tf-multi-provider
/
main.tf
101 lines (79 loc) · 2.3 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
* Unfortunately Terraform does not support using the count parameter
* with custom modules, for more details see:
* https://github.com/hashicorp/terraform/issues/953
*
* Because of this to add a region/zone you have to copy a provider
* module and give it a different region/size argument.
*/
/* Digital Ocean */
module "do-eu-amsterdam3" {
source = "github.com/status-im/infra-tf-digital-ocean"
/* specific */
name = var.name
env = var.env
group = var.group
/* scaling */
host_count = var.host_count
size = var.do_size
vol_size = var.do_vol_size
region = "ams3"
/* general */
domain = var.domain
/* firewall */
open_ports = var.open_ports
}
resource "cloudflare_record" "do-eu-amsterdam3" {
domain = var.domain
name = "nodes.do-ams3.${var.env}.${terraform.workspace}"
value = module.do-eu-amsterdam3.public_ips[count.index]
count = length(module.do-eu-amsterdam3.public_ips)
type = "A"
}
/* Google Cloud */
module "gc-us-central1-a" {
source = "github.com/status-im/infra-tf-google-cloud"
/* specific */
name = var.name
env = var.env
group = var.group
/* scaling */
host_count = var.host_count
type = var.gc_size
vol_size = var.gc_vol_size
zone = "us-central1-a"
/* general */
domain = var.domain
/* firewall */
open_ports = var.open_ports
}
resource "cloudflare_record" "gc-us-central1-a" {
domain = var.domain
name = "nodes.gc-us-central1-a.${var.env}.${terraform.workspace}"
value = module.gc-us-central1-a.public_ips[count.index]
count = length(module.gc-us-central1-a.public_ips)
type = "A"
}
/* Alibaba Cloud */
module "ac-cn-hongkong-c" {
source = "github.com/status-im/infra-tf-alibaba-cloud"
/* specific */
name = var.name
env = var.env
group = var.group
/* scaling */
host_count = var.host_count
type = var.ac_size
zone = "cn-hongkong-c"
/* general */
domain = var.domain
/* firewall */
open_ports = var.open_ports
}
resource "cloudflare_record" "ac-cn-hongkong-c" {
domain = var.domain
name = "nodes.ac-cn-hongkong-c.${var.env}.${terraform.workspace}"
value = module.ac-cn-hongkong-c.public_ips[count.index]
count = length(module.ac-cn-hongkong-c.public_ips)
type = "A"
}