Skip to content

Commit

Permalink
Fix the provision of vm using quotaID's with sshkeys, imageid
Browse files Browse the repository at this point in the history
  • Loading branch information
hkantare committed Apr 1, 2021
1 parent ebe8963 commit d534e23
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions ibm/resource_ibm_compute_vm_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,31 @@ func placeOrder(d *schema.ResourceData, meta interface{}, name string, publicVla
template.VirtualGuests,
options[0],
)
// Get configured ssh_keys
sshKeySet := d.Get("ssh_key_ids").(*schema.Set)
sshKeys := sshKeySet.List()
sshKeyLen := len(sshKeys)
if sshKeyLen > 0 {
template.SshKeys = make([]datatypes.Container_Product_Order_SshKeys, 0, sshKeyLen)
for _, sshKey := range sshKeys {
sshKeyA := make([]int, 1)
sshKeyA[0] = sshKey.(int)
template.SshKeys = append(template.SshKeys, datatypes.Container_Product_Order_SshKeys{
SshKeyIds: sshKeyA,
})
}
}
if rawImageTemplateId, ok := d.GetOk("image_template_id"); ok {
imageTemplateId := rawImageTemplateId.(int)
template.ImageTemplateId = sl.Int(imageTemplateId)
}

if postInstallURI, ok := d.GetOk("post_install_script_uri"); ok {
postInstallURIA := make([]string, 1)
postInstallURIA[0] = postInstallURI.(string)
template.ProvisionScripts = postInstallURIA
}

guestOrders = append(guestOrders, template)
} else {
for i := 0; i < len(options); i++ {
Expand Down

0 comments on commit d534e23

Please sign in to comment.