This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/cloudstack-terraform-provider.git


The following commit(s) were added to refs/heads/main by this push:
     new 8dd95a2  Add support to provide VM details during VM deployment - when 
using custom offering (#7)
8dd95a2 is described below

commit 8dd95a2dc97e3ef8645dde671e3f66df40928742
Author: Pearl Dsilva <[email protected]>
AuthorDate: Wed Oct 6 10:11:00 2021 +0530

    Add support to provide VM details during VM deployment - when using custom 
offering (#7)
---
 cloudstack/resource_cloudstack_instance.go | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

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 @@ func resourceCloudStackInstance() *schema.Resource {
                                },
                        },
 
+                       "details": {
+                               Type:     schema.TypeMap,
+                               Optional: true,
+                       },
+
                        "expunge": {
                                Type:     schema.TypeBool,
                                Optional: true,
@@ -206,7 +211,13 @@ func resourceCloudStackInstanceCreate(d 
*schema.ResourceData, meta interface{})
        // 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 {

Reply via email to