Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit 6e98f67

Browse files
committed
fix interface attach/detach
1 parent 243312c commit 6e98f67

File tree

5 files changed

+459
-19
lines changed

5 files changed

+459
-19
lines changed

docs/index.md

Lines changed: 216 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,225 @@ terraform {
1818
required_providers {
1919
gcore = {
2020
source = "local.gcorelabs.com/repo/gcore"
21-
version = "~>0.0.11"
21+
version = "~>0.0.12"
2222
}
2323
}
2424
}
25+
26+
provider gcore {
27+
user_name = "[email protected]"
28+
password = "testtest"
29+
gcore_platform = "http://api.stg-45.staging.gcdn.co"
30+
gcore_api = "http://10.100.179.92:33081"
31+
}
32+
33+
resource "gcore_keypair" "kp" {
34+
project_id = 1
35+
public_key = "your oub key"
36+
sshkey_name = "testkey"
37+
}
38+
39+
resource "gcore_network" "network" {
40+
name = "network_example"
41+
mtu = 1450
42+
type = "vxlan"
43+
region_id = 1
44+
project_id = 1
45+
}
46+
47+
resource "gcore_subnet" "subnet" {
48+
name = "subnet_example"
49+
cidr = "192.168.10.0/24"
50+
network_id = gcore_network.network.id
51+
dns_nameservers = ["8.8.4.4", "1.1.1.1"]
52+
53+
host_routes {
54+
destination = "10.0.3.0/24"
55+
nexthop = "10.0.0.13"
56+
}
57+
58+
gateway_ip = "192.168.10.1"
59+
region_id = 1
60+
project_id = 1
61+
}
62+
63+
resource "gcore_subnet" "subnet2" {
64+
name = "subnet2_example"
65+
cidr = "192.168.20.0/24"
66+
network_id = gcore_network.network.id
67+
dns_nameservers = ["8.8.4.4", "1.1.1.1"]
68+
69+
host_routes {
70+
destination = "10.0.3.0/24"
71+
nexthop = "10.0.0.13"
72+
}
73+
74+
gateway_ip = "192.168.20.1"
75+
region_id = 1
76+
project_id = 1
77+
}
78+
79+
resource "gcore_volume" "first_volume" {
80+
name = "boot volume"
81+
type_name = "ssd_hiiops"
82+
size = 6
83+
image_id = "f4ce3d30-e29c-4cfd-811f-46f383b6081f"
84+
region_id = 1
85+
project_id = 1
86+
}
87+
88+
resource "gcore_volume" "second_volume" {
89+
name = "second volume"
90+
type_name = "ssd_hiiops"
91+
image_id = "f4ce3d30-e29c-4cfd-811f-46f383b6081f"
92+
size = 6
93+
region_id = 1
94+
project_id = 1
95+
}
96+
97+
resource "gcore_volume" "third_volume" {
98+
name = "third volume"
99+
type_name = "ssd_hiiops"
100+
size = 6
101+
region_id = 1
102+
project_id = 1
103+
}
104+
105+
resource "gcore_instance" "instance" {
106+
flavor_id = "g1-standard-2-4"
107+
name = "test"
108+
keypair_name = gcore_keypair.kp.sshkey_name
109+
110+
volume {
111+
source = "existing-volume"
112+
volume_id = gcore_volume.first_volume.id
113+
boot_index = 0
114+
}
115+
116+
interface {
117+
type = "subnet"
118+
network_id = gcore_network.network.id
119+
subnet_id = gcore_subnet.subnet.id
120+
}
121+
122+
interface {
123+
type = "subnet"
124+
network_id = gcore_network.network.id
125+
subnet_id = gcore_subnet.subnet2.id
126+
}
127+
128+
security_group {
129+
id = "66988147-f1b9-43b2-aaef-dee6d009b5b7"
130+
name = "default"
131+
}
132+
133+
metadata {
134+
key = "some_key"
135+
value = "some_data"
136+
}
137+
138+
configuration {
139+
key = "some_key"
140+
value = "some_data"
141+
}
142+
143+
region_id = 1
144+
project_id = 1
145+
}
146+
147+
resource "gcore_loadbalancer" "lb" {
148+
project_id = 1
149+
region_id = 1
150+
name = "test1"
151+
flavor = "lb1-1-2"
152+
listener {
153+
name = "test"
154+
protocol = "HTTP"
155+
protocol_port = 80
156+
}
157+
}
158+
159+
resource "gcore_lbpool" "pl" {
160+
project_id = 1
161+
region_id = 1
162+
name = "test_pool1"
163+
protocol = "HTTP"
164+
lb_algorithm = "LEAST_CONNECTIONS"
165+
loadbalancer_id = gcore_loadbalancer.lb.id
166+
listener_id = gcore_loadbalancer.lb.listener.0.id
167+
health_monitor {
168+
type = "PING"
169+
delay = 60
170+
max_retries = 5
171+
timeout = 10
172+
}
173+
session_persistence {
174+
type = "APP_COOKIE"
175+
cookie_name = "test_new_cookie"
176+
}
177+
}
178+
179+
resource "gcore_lbmember" "lbm" {
180+
project_id = 1
181+
region_id = 1
182+
pool_id = gcore_lbpool.pl.id
183+
instance_id = gcore_instance.instance.id
184+
address = tolist(gcore_instance.instance.interface).0.ip_address
185+
protocol_port = 8081
186+
weight = 5
187+
}
188+
189+
resource "gcore_instance" "instance2" {
190+
flavor_id = "g1-standard-2-4"
191+
name = "test2"
192+
keypair_name = gcore_keypair.kp.sshkey_name
193+
194+
volume {
195+
source = "existing-volume"
196+
volume_id = gcore_volume.second_volume.id
197+
boot_index = 0
198+
}
199+
200+
volume {
201+
source = "existing-volume"
202+
volume_id = gcore_volume.third_volume.id
203+
boot_index = 1
204+
}
205+
206+
interface {
207+
type = "subnet"
208+
network_id = gcore_network.network.id
209+
subnet_id = gcore_subnet.subnet.id
210+
}
211+
212+
security_group {
213+
id = "66988147-f1b9-43b2-aaef-dee6d009b5b7"
214+
name = "default"
215+
}
216+
217+
metadata {
218+
key = "some_key"
219+
value = "some_data"
220+
}
221+
222+
configuration {
223+
key = "some_key"
224+
value = "some_data"
225+
}
226+
227+
region_id = 1
228+
project_id = 1
229+
}
230+
231+
resource "gcore_lbmember" "lbm2" {
232+
project_id = 1
233+
region_id = 1
234+
pool_id = gcore_lbpool.pl.id
235+
instance_id = gcore_instance.instance2.id
236+
address = tolist(gcore_instance.instance2.interface).0.ip_address
237+
protocol_port = 8081
238+
weight = 5
239+
}
25240
```
26241

27242
<!-- schema generated by tfplugindocs -->

0 commit comments

Comments
 (0)