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

Commit 62af52b

Browse files
committed
instance volumes/interfaces attach/detach fixed
last_update added to loadbalancers resources update method reosurce_gcore_instances name - TypeList -> TypeString loadbalancer listeners -> listener
1 parent 461cf06 commit 62af52b

14 files changed

+360
-209
lines changed

examples/instance/main.tf

Lines changed: 55 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,35 @@ provider gcore {
44
gcore_platform = "http://api.stg-45.staging.gcdn.co"
55
gcore_api = "http://10.100.179.92:33081"
66
}
7+
resource "gcore_network" "network" {
8+
name = "network_example"
9+
mtu = 1450
10+
type = "vxlan"
11+
region_id = 1
12+
project_id = 1
13+
}
14+
15+
resource "gcore_subnet" "subnet" {
16+
name = "subnet_example"
17+
cidr = "192.168.10.0/24"
18+
network_id = gcore_network.network.id
19+
dns_nameservers = ["8.8.4.4", "1.1.1.1"]
20+
21+
host_routes {
22+
destination = "10.0.3.0/24"
23+
nexthop = "10.0.0.13"
24+
}
25+
26+
gateway_ip = "192.168.10.1"
27+
region_id = 1
28+
project_id = 1
29+
}
730

831
resource "gcore_volume" "first_volume" {
932
name = "boot volume"
1033
type_name = "ssd_hiiops"
1134
size = 5
12-
image_id = "f3847215-e4d7-4e64-8e69-14637e68e27f"
35+
image_id = "f4ce3d30-e29c-4cfd-811f-46f383b6081f"
1336
region_id = 1
1437
project_id = 1
1538
}
@@ -22,65 +45,50 @@ resource "gcore_volume" "second_volume" {
2245
project_id = 1
2346
}
2447

25-
locals {
26-
volumes_ids = [gcore_volume.first_volume.id, gcore_volume.second_volume.id]
27-
}
28-
2948
resource "gcore_instance" "instance" {
3049
flavor_id = "g1-standard-2-4"
31-
name = var.names
50+
name = "test"
3251

33-
dynamic volumes {
34-
iterator = vol
35-
for_each = local.volumes_ids
36-
content {
37-
boot_index = index(local.volumes_ids, vol.value)
52+
volume {
3853
source = "existing-volume"
39-
volume_id = vol.value
40-
}
54+
volume_id = gcore_volume.first_volume.id
55+
boot_index = 0
4156
}
4257

43-
dynamic interfaces {
44-
iterator = iface
45-
for_each = var.interfaces
46-
content {
47-
type = iface.value.type
48-
network_id = iface.value.network_id
49-
subnet_id = iface.value.subnet_id
50-
fip_source = iface.value.fip_source
51-
existing_fip_id =iface.value.existing_fip_id
52-
port_id = iface.value.port_id
53-
ip_address = iface.value.ip_address
54-
}
58+
volume {
59+
source = "existing-volume"
60+
volume_id = gcore_volume.second_volume.id
61+
boot_index = 1
5562
}
5663

57-
dynamic security_groups {
58-
iterator = sg
59-
for_each = var.security_groups
60-
content {
61-
id = sg.value.id
62-
name = sg.value.name
63-
}
64+
interface {
65+
type = "subnet"
66+
network_id = gcore_network.network.id
67+
subnet_id = gcore_subnet.subnet.id
68+
//port_id = null
69+
//ip_address = null
70+
//fip_source = null
71+
//existing_fip_id = null
6472
}
6573

66-
dynamic metadata {
67-
iterator = md
68-
for_each = var.metadata
69-
content {
70-
key = md.value.key
71-
value = md.value.value
72-
}
74+
75+
security_group {
76+
id = "d75db0b2-58f1-4a11-88c6-a932bb897310"
77+
name = "default"
7378
}
7479

75-
dynamic configuration {
76-
iterator = cfg
77-
for_each = var.configuration
78-
content {
79-
key = cfg.value.key
80-
value = cfg.value.value
81-
}
80+
metadata {
81+
key = "some_key"
82+
value = "some_data"
83+
}
84+
85+
configuration {
86+
key = "some_key"
87+
value = "some_data"
8288
}
8389

8490
region_id = 1
8591
project_id = 1
86-
}
92+
}
93+
94+

examples/instance/vars.tf

Lines changed: 0 additions & 78 deletions
This file was deleted.

examples/lblistener/main.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ resource "gcore_loadbalancer" "lb" {
1010
region_id = 1
1111
name = "test"
1212
flavor = "lb1-1-2"
13-
listeners {
13+
listener {
1414
name = "test"
1515
protocol = "HTTP"
1616
protocol_port = 80
1717
}
18+
19+
listener {
20+
name = "test3"
21+
protocol = "HTTP"
22+
protocol_port = 8080
23+
}
1824
}
1925

2026
resource "gcore_lblistener" "listener" {

examples/versions/version.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ terraform {
33
required_providers {
44
gcore = {
55
source = "local.gcorelabs.com/repo/gcore"
6-
version = "~>0.0.9"
6+
version = "~>0.0.10"
77
}
88
}
99
}

0 commit comments

Comments
 (0)