Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/vapp properties added #62

Merged
merged 3 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cloudstack/data_source_cloudstack_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"github.com/hashicorp/terraform/helper/resource"
)

//basic acceptance to check if the display_name attribute has same value in
//the created instance and its data source respectively.
// basic acceptance to check if the display_name attribute has same value in
// the created instance and its data source respectively.
func TestAccInstanceDataSource_basic(t *testing.T) {
resourceName := "cloudstack_instance.my_instance"
datasourceName := "data.cloudstack_instance.my_instance_test"
Expand Down
31 changes: 31 additions & 0 deletions cloudstack/resource_cloudstack_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ func resourceCloudStackInstance() *schema.Resource {
Optional: true,
},

"properties": {
Type: schema.TypeMap,
Optional: true,
},

"nicnetworklist": {
Type: schema.TypeMap,
Optional: true,
},

"expunge": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -218,6 +228,27 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{})
}
p.SetDetails(vmDetails)
}

// Set VM Properties
vmProperties := make(map[string]string)
if properties, ok := d.GetOk("properties"); ok {
for k, v := range properties.(map[string]interface{}) {
vmProperties[k] = v.(string)
}
p.SetProperties(vmProperties)
}

// SetNicNetworkList
if nicnetworklist, ok := d.GetOk("nicnetworklist"); ok {
nicNetworkDetails := []map[string]string{
{
"nic": nicnetworklist.(map[string]interface{})["nic"].(string),
"network": nicnetworklist.(map[string]interface{})["network"].(string),
},
}
p.SetNicnetworklist(nicNetworkDetails)
}

// Set the name
name, hasName := d.GetOk("name")
if hasName {
Expand Down
2 changes: 1 addition & 1 deletion cloudstack/resource_cloudstack_network_offering.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func resourceCloudStackNetworkOfferingCreate(d *schema.ResourceData, meta interf
traffic_type := d.Get("traffic_type").(string)

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

if guest_ip_type == "Shared" {
p.SetSpecifyvlan(true)
Expand Down