-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
104 lines (92 loc) · 2.21 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
101
102
103
104
terraform {
required_providers {
grid = {
source = "threefoldtech/grid"
# version = "1.9.3-dev"
}
}
}
provider "grid" {
mnemonics = ""
network = "qa"
}
data "grid_gateway_domain" "server_domain" {
node = 2
name = "cshrserver"
}
data "grid_gateway_domain" "client_domain" {
node = 2
name = "cshr"
}
resource "grid_network" "net2" {
nodes = [2]
ip_range = "10.1.0.0/16"
name = "cshrnetworks"
description = "er network"
add_wg_access = true
}
resource "grid_deployment" "d1" {
node = 2
network_name = grid_network.net2.name
vms {
name = ""
flist = ""
cpu = 2
memory = 4096
publicip = false
planetary = true
entrypoint = ""
env_vars = {
ENV=""
DJANGO_DEBUG=""
EMAIL=""
EMAIL_PASSWORD=""
EMAIL_HOST=""
REDIS_HOST=""
DJANGO_SUPERUSER_EMAIL=""
DJANGO_SUPERUSER_PASSWORD=""
SERVER_DOMAIN_NAME=format(data.grid_gateway_domain.server_domain.fqdn)
CLIENT_DOMAIN_NAME=format(data.grid_gateway_domain.client_domain.fqdn)
}
}
}
resource "grid_deployment" "d2" {
node = 2
network_name = grid_network.net2.name
vms {
name = ""
publicip = false
planetary = true
flist = ""
cpu = 2
memory = 4096
entrypoint = "/sbin/zinit init"
env_vars = {
SERVER_BASE_URL=format("https://%s", data.grid_gateway_domain.server_domain.fqdn)
}
}
}
resource "grid_name_proxy" "p1" {
node = 2
name = "cshrserver"
backends = [format("http://[%s]:8000", grid_deployment.d1.vms[0].ygg_ip)]
tls_passthrough = false
}
resource "grid_name_proxy" "p2" {
node = 2
name = "cshr"
backends = [format("http://[%s]:8080", grid_deployment.d2.vms[0].ygg_ip)]
tls_passthrough = false
}
output "server_domain" {
value = data.grid_gateway_domain.server_domain.fqdn
}
output "client_domain" {
value = data.grid_gateway_domain.client_domain.fqdn
}
output "server_ygg_ip" {
value = grid_deployment.d1.vms[0].ygg_ip
}
output "client_ygg_ip" {
value = grid_deployment.d2.vms[0].ygg_ip
}