Add support to provide VM details during VM deployment - when using custom offering (#7)
diff --git a/cloudstack/resource_cloudstack_instance.go b/cloudstack/resource_cloudstack_instance.go
index 0799f92..c860628 100644
--- a/cloudstack/resource_cloudstack_instance.go
+++ b/cloudstack/resource_cloudstack_instance.go
@@ -165,6 +165,11 @@
},
},
+ "details": {
+ Type: schema.TypeMap,
+ Optional: true,
+ },
+
"expunge": {
Type: schema.TypeBool,
Optional: true,
@@ -206,7 +211,13 @@
// Create a new parameter struct
p := cs.VirtualMachine.NewDeployVirtualMachineParams(serviceofferingid, templateid, zone.Id)
p.SetStartvm(d.Get("start_vm").(bool))
-
+ vmDetails := make(map[string]string)
+ if details, ok := d.GetOk("details"); ok {
+ for k, v := range details.(map[string]interface{}) {
+ vmDetails[k] = v.(string)
+ }
+ p.SetDetails(vmDetails)
+ }
// Set the name
name, hasName := d.GetOk("name")
if hasName {