-
Notifications
You must be signed in to change notification settings - Fork 0
/
terraform.tfvars
210 lines (200 loc) · 4.13 KB
/
terraform.tfvars
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# scw region
scw_region = "fr-par"
# scw zone
scw_zone = "fr-par-1"
# project name
project = "default"
# cluster id
cluster = 1
# ssh key path without passphrase
keypath = "~/.ssh/deployment"
# common networks for simplify install process and other
# the three networks it's required for run remote cmd and apt-get update
common_networks = ["ssh_public", "dns", "public"]
# define your infrastructure
infra = {
proxy = {
scale = 1
public_ip = true
image = "1ec3f179-5b05-408f-a8b3-344e4d8d22d9"
type = "DEV1-S"
services = [ "nginx" ]
},
web = {
scale = 1
public_ip = false
image = "1ec3f179-5b05-408f-a8b3-344e4d8d22d9"
type = "DEV1-S"
services = [ "wordpress" ]
},
database = {
scale = 1
public_ip = true
image = "1ec3f179-5b05-408f-a8b3-344e4d8d22d9"
type = "DEV1-S"
services = [ "mysql" ]
},
}
## define the networks link services
services = {
nginx = {
networks = {
hosted = ["public"]
linked = ["web"]
}
install = [
"apt-get install -y nginx",
]
run = [
"/etc/init.d/nginx start"
]
}
wordpress = {
networks = {
hosted = ["web"]
linked = ["database"]
}
install = [
"apt install -y apache2",
"wget https://codeload.github.com/WordPress/WordPress/zip/master",
"unzip master",
"rm -rf /var/www/html",
"mv WordPress-master /var/www/html",
"sed -i 's/Listen 80/Listen 0.0.0.0:8080/g' /etc/apache2/ports.conf",
"sed -i 's/:80/:8080/g' /etc/apache2/sites-available/000-default.conf",
"apt install libapache2-mod-php",
"apt-get install php7.2-mysql",
"service apache2 restart",
]
run = []
}
mysql = {
networks = {
hosted = ["database"]
linked = []
}
install = [
"apt-get update && apt-get upgrade -y",
"echo 'Europe/Paris' > /etc/timezone",
"echo 'mysql-server-5.6 mysql-server/root_password password root' | debconf-set-selections",
"echo 'mysql-server-5.6 mysql-server/root_password_again password root' | debconf-set-selections",
"apt-get -y install mysql-server",
"mysql_secure_installation",
"sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/mysql.conf.d/mysqld.cnf",
"mysql -uroot -proot -e 'USE mysql; UPDATE `user` SET `Host`=\"%\" WHERE `User`=\"root\" AND `Host`=\"localhost\"; DELETE FROM `user` WHERE `Host` != \"%\" AND `User`=\"root\"; FLUSH PRIVILEGES;'",
"service mysql restart",
]
run = []
}
}
## define each network
networks = {
dns = {
all = [
{
action = "accept"
port = 53
protocol = "TCP"
ip = "address"
},
{
action = "accept"
port = 53
protocol = "UDP"
ip = "address"
},
{
action = "accept"
port = 53
protocol = "TCP"
ip = "::/0"
},
{
action = "accept"
port = 53
protocol = "UDP"
ip = "::/0"
}
]
in = []
out = []
}
public = {
all = [
{
action = "accept"
port = 80
protocol = "TCP"
ip = "address"
},
{
action = "accept"
port = 443
protocol = "TCP"
ip = "address"
},
{
action = "accept"
port = 80
protocol = "TCP"
ip = "::/0"
},
{
action = "accept"
port = 443
protocol = "TCP"
ip = "::/0"
}
]
in = []
out = []
},
web = {
all = [
{
action = "accept"
port = 8080
protocol = "TCP"
ip = "private"
}
]
in = []
out = []
},
database = {
all = [
{
action = "accept"
port = 3306
protocol = "TCP"
ip = "private"
}
]
in = []
out = []
},
ssh_public = {
all = [
{
action = "accept"
port = 22
protocol = "TCP"
ip = "address"
}
]
in = []
out = []
},
ssh_private = {
all = [
{
action = "accept"
port = 22
protocol = "TCP"
ip = "private"
}
]
in = []
out = []
},
}