Skip to content

Commit 0ae900a

Browse files
Z-eeshanZeeshan Saeed
authored andcommitted
Feature/vapp properties added (apache#62)
- This PR adds vApp Properties field for VMWare related configs and also nicnetworklist paramters from Cloudstack API - Also code on main branch is not compilble due to an extra argument passed to one of the function's of code. This PR also resolves that. Co-authored-by: Zeeshan Saeed <[email protected]>
1 parent 07c4286 commit 0ae900a

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

cloudstack/data_source_cloudstack_instance_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import (
2525
"github.com/hashicorp/terraform/helper/resource"
2626
)
2727

28-
//basic acceptance to check if the display_name attribute has same value in
29-
//the created instance and its data source respectively.
28+
// basic acceptance to check if the display_name attribute has same value in
29+
// the created instance and its data source respectively.
3030
func TestAccInstanceDataSource_basic(t *testing.T) {
3131
resourceName := "cloudstack_instance.my_instance"
3232
datasourceName := "data.cloudstack_instance.my_instance_test"

cloudstack/resource_cloudstack_instance.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@ func resourceCloudStackInstance() *schema.Resource {
170170
Optional: true,
171171
},
172172

173+
"properties": {
174+
Type: schema.TypeMap,
175+
Optional: true,
176+
},
177+
178+
"nicnetworklist": {
179+
Type: schema.TypeMap,
180+
Optional: true,
181+
},
182+
173183
"expunge": {
174184
Type: schema.TypeBool,
175185
Optional: true,
@@ -218,6 +228,27 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{})
218228
}
219229
p.SetDetails(vmDetails)
220230
}
231+
232+
// Set VM Properties
233+
vmProperties := make(map[string]string)
234+
if properties, ok := d.GetOk("properties"); ok {
235+
for k, v := range properties.(map[string]interface{}) {
236+
vmProperties[k] = v.(string)
237+
}
238+
p.SetProperties(vmProperties)
239+
}
240+
241+
// SetNicNetworkList
242+
if nicnetworklist, ok := d.GetOk("nicnetworklist"); ok {
243+
nicNetworkDetails := []map[string]string{
244+
{
245+
"nic": nicnetworklist.(map[string]interface{})["nic"].(string),
246+
"network": nicnetworklist.(map[string]interface{})["network"].(string),
247+
},
248+
}
249+
p.SetNicnetworklist(nicNetworkDetails)
250+
}
251+
221252
// Set the name
222253
name, hasName := d.GetOk("name")
223254
if hasName {

cloudstack/resource_cloudstack_network_offering.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func resourceCloudStackNetworkOfferingCreate(d *schema.ResourceData, meta interf
6262
traffic_type := d.Get("traffic_type").(string)
6363

6464
// Create a new parameter struct
65-
p := cs.NetworkOffering.NewCreateNetworkOfferingParams(display_text, guest_ip_type, name, []string{}, traffic_type)
65+
p := cs.NetworkOffering.NewCreateNetworkOfferingParams(display_text, guest_ip_type, name, traffic_type)
6666

6767
if guest_ip_type == "Shared" {
6868
p.SetSpecifyvlan(true)

0 commit comments

Comments
 (0)