-
Notifications
You must be signed in to change notification settings - Fork 0
/
app-back-hosts.tf
182 lines (145 loc) · 4.77 KB
/
app-back-hosts.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
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
# Экземпляры машин BACK
# Создаем порты отдельным ресурсом, так как параметр "fixed_ip_v4"
# для ресурсов "vkcs_compute_instance" корректно не работает
resource "vkcs_networking_port" "zone1-back_port" {
network_id = vkcs_networking_network.DR_vnet.id
name = "zone1 Back Port"
description = "zone1 Back Port"
fixed_ip {
subnet_id = vkcs_networking_subnet.zone1-vnet100.id
ip_address = "172.16.100.20"
}
security_group_ids = [vkcs_networking_secgroup.interconnect.id]
}
resource "vkcs_networking_port" "zone1-back-to-db-port" {
network_id = vkcs_networking_network.dbcluster-net.id
name = "zone1 Back to Database Port"
description = "zone1 Back to Database Port"
fixed_ip {
subnet_id = vkcs_networking_subnet.dbcluster-subnet.id
ip_address = "172.16.50.150"
}
security_group_ids = [vkcs_networking_secgroup.interconnect.id]
}
resource "vkcs_compute_instance" "zone1-back" {
name = "zone1-back"
flavor_name = var.back_flavor
security_group_ids = [vkcs_networking_secgroup.interconnect.id]
availability_zone = var.zones["zone1"]
#var.zones["zone1"]
key_pair = var.key_pair_name
tags = ["reference_arch"]
metadata = {
sid = "reference_arch"
}
block_device {
source_type = "image"
destination_type = "volume"
volume_type = "ceph-ssd"
uuid = data.vkcs_images_image.ubuntu.id
volume_size = 10
boot_index = 0
delete_on_termination = true
}
config_drive = true
network {
port = vkcs_networking_port.zone1-back_port.id
}
network {
port = vkcs_networking_port.zone1-back-to-db-port.id
}
}
resource "vkcs_networking_port" "zone2-back_port" {
network_id = vkcs_networking_network.DR_vnet.id
name = "zone2 Back Port"
description = "zone2 Back Port"
fixed_ip {
subnet_id = vkcs_networking_subnet.zone2-vnet200.id
ip_address = "172.16.200.20"
}
security_group_ids = [vkcs_networking_secgroup.interconnect.id]
}
resource "vkcs_networking_port" "zone2-back-to-db-port" {
network_id = vkcs_networking_network.dbcluster-net.id
name = "zone2 Back to Database Port"
description = "zone2 Back to Database Port"
fixed_ip {
subnet_id = vkcs_networking_subnet.dbcluster-subnet.id
ip_address = "172.16.50.151"
}
security_group_ids = [vkcs_networking_secgroup.interconnect.id]
}
resource "vkcs_compute_instance" "zone2-back" {
name = "zone2-back"
flavor_name = var.back_flavor
security_group_ids = [vkcs_networking_secgroup.interconnect.id]
availability_zone = var.zones["zone2"]
key_pair = var.key_pair_name
tags = ["reference_arch"]
metadata = {
sid = "reference_arch"
}
block_device {
source_type = "image"
destination_type = "volume"
volume_type = "ceph-ssd"
uuid = data.vkcs_images_image.ubuntu.id
volume_size = 10
boot_index = 0
delete_on_termination = true
}
config_drive = true
network {
port = vkcs_networking_port.zone2-back_port.id
}
network {
port = vkcs_networking_port.zone2-back-to-db-port.id
}
}
resource "vkcs_networking_port" "zone3-back_port" {
network_id = vkcs_networking_network.DR_vnet.id
name = "zone3 Back Port"
description = "zone3 Back Port"
fixed_ip {
subnet_id = vkcs_networking_subnet.zone3-vnet000.id
ip_address = "172.16.0.20"
}
security_group_ids = [vkcs_networking_secgroup.interconnect.id]
}
resource "vkcs_networking_port" "zone3-back-to-db-port" {
network_id = vkcs_networking_network.dbcluster-net.id
name = "zone3 Back to Database Port"
description = "zone3 Back to Database Port"
fixed_ip {
subnet_id = vkcs_networking_subnet.dbcluster-subnet.id
ip_address = "172.16.50.152"
}
security_group_ids = [vkcs_networking_secgroup.interconnect.id]
}
resource "vkcs_compute_instance" "zone3-back" {
name = "zone3-back"
flavor_name = var.back_flavor
security_group_ids = [vkcs_networking_secgroup.interconnect.id]
availability_zone = var.zones["zone3"]
key_pair = var.key_pair_name
tags = ["reference_arch"]
metadata = {
sid = "reference_arch"
}
block_device {
source_type = "image"
destination_type = "volume"
volume_type = "ceph-ssd"
uuid = data.vkcs_images_image.ubuntu.id
volume_size = 10
boot_index = 0
delete_on_termination = true
}
config_drive = true
network {
port = vkcs_networking_port.zone3-back_port.id
}
network {
port = vkcs_networking_port.zone3-back-to-db-port.id
}
}