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

Commit a18349c

Browse files
author
Alexandr Sokolov
committed
create_router added to gcore_network resource, gcore_subnet update method fixed
1 parent cb78947 commit a18349c

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

gcore/resource_gcore_network.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ func resourceNetwork() *schema.Resource {
8888
Computed: true,
8989
Description: "'vlan' or 'vxlan' network type is allowed. Default value is 'vxlan'",
9090
},
91+
"create_router": &schema.Schema{
92+
Type: schema.TypeBool,
93+
Optional: true,
94+
Description: "Create external router to the network, default false",
95+
},
9196
"last_updated": &schema.Schema{
9297
Type: schema.TypeString,
9398
Optional: true,
@@ -108,10 +113,15 @@ func resourceNetworkCreate(ctx context.Context, d *schema.ResourceData, m interf
108113
return diag.FromErr(err)
109114
}
110115

116+
var createRouter bool
117+
//for backwards compatibility
118+
createRouter, _ = d.Get("create_router").(bool)
119+
111120
createOpts := networks.CreateOpts{
112-
Name: d.Get("name").(string),
113-
Mtu: d.Get("mtu").(int),
114-
Type: d.Get("type").(string),
121+
Name: d.Get("name").(string),
122+
Mtu: d.Get("mtu").(int),
123+
Type: d.Get("type").(string),
124+
CreateRouter: createRouter,
115125
}
116126

117127
results, err := networks.Create(client, createOpts).Extract()

gcore/resource_gcore_subnet.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ func resourceSubnet() *schema.Resource {
9999
"dns_nameservers": &schema.Schema{
100100
Type: schema.TypeList,
101101
Optional: true,
102+
Computed: true,
102103
Elem: &schema.Schema{
103104
Type: schema.TypeString,
104105
},

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module github.com/terraform-providers/terraform-provider-gcorelabs
22

33
go 1.16
44

5-
//replace github.com/G-Core/gcorelabscloud-go => /home/ondi/go/src/github.com/G-Core/gcorelabscloud-go
6-
75
require (
86
github.com/G-Core/g-dns-sdk-go v0.1.2
97
github.com/G-Core/gcorelabs-storage-sdk-go v0.0.9

0 commit comments

Comments
 (0)