Skip to content

Commit 3fef017

Browse files
committed
Merge branch 'fix-update-network-offering' of https://github.com/apache/cloudstack-terraform-provider into add-additional-params-netOff
2 parents 0fdc310 + 4ab1d5f commit 3fef017

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

cloudstack/resource_cloudstack_network_offering.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,15 @@ func resourceCloudStackNetworkOfferingUpdate(d *schema.ResourceData, meta interf
253253

254254
}
255255

256-
// Check if the display text is changed and if so, update the virtual machine
256+
// Check if the display text is changed and if so, update the network offering
257257
if d.HasChange("display_text") {
258258
log.Printf("[DEBUG] Display text changed for %s, starting update", name)
259259

260260
// Create a new parameter struct
261261
p := cs.NetworkOffering.NewUpdateNetworkOfferingParams()
262262

263263
// Set the new display text
264-
p.SetName(d.Get("display_text").(string))
264+
p.SetDisplaytext(d.Get("display_text").(string))
265265

266266
// Update the display text
267267
_, err := cs.NetworkOffering.UpdateNetworkOffering(p)
@@ -272,34 +272,34 @@ func resourceCloudStackNetworkOfferingUpdate(d *schema.ResourceData, meta interf
272272

273273
}
274274

275-
// Check if the guest ip type is changed and if so, update the virtual machine
276-
if d.HasChange("guest_ip_type") {
277-
log.Printf("[DEBUG] Guest ip type changed for %s, starting update", name)
275+
// Check if maxconnections is changed and if so, update the network offering
276+
if d.HasChange("max_connections") {
277+
log.Printf("[DEBUG] Max connections changed for %s, starting update", name)
278278

279279
// Create a new parameter struct
280280
p := cs.NetworkOffering.NewUpdateNetworkOfferingParams()
281281

282-
// Set the new guest ip type
283-
p.SetName(d.Get("guest_ip_type").(string))
282+
// Set the new max connections
283+
p.SetMaxconnections(d.Get("max_connections").(int))
284284

285-
// Update the guest ip type
285+
// Update the max connections
286286
_, err := cs.NetworkOffering.UpdateNetworkOffering(p)
287287
if err != nil {
288288
return fmt.Errorf(
289-
"Error updating the guest ip type for network offering %s: %s", name, err)
289+
"Error updating the max connections for network offering %s: %s", name, err)
290290
}
291291

292292
}
293293

294-
// Check if the traffic type is changed and if so, update the virtual machine
295-
if d.HasChange("traffic_type") {
296-
log.Printf("[DEBUG] Traffic type changed for %s, starting update", name)
294+
// Check if the domain id is changed and if so, update the network offering
295+
if d.HasChange("domain_id") {
296+
log.Printf("[DEBUG] Domain id changed for %s, starting update", name)
297297

298298
// Create a new parameter struct
299299
p := cs.NetworkOffering.NewUpdateNetworkOfferingParams()
300300

301-
// Set the new traffic type
302-
p.SetName(d.Get("traffic_type").(string))
301+
// Set the new domain id
302+
p.SetDomainid(d.Get("domain_id").(string))
303303

304304
// Update the traffic type
305305
_, err := cs.NetworkOffering.UpdateNetworkOffering(p)

0 commit comments

Comments
 (0)