restore ssh port option for ssh_forward

This commit is contained in:
Grant Gongaware 2019-09-04 12:45:02 -07:00
parent baf8df69f7
commit 23e407d44c

View File

@ -290,8 +290,8 @@ func resourceVmQemu() *schema.Resource {
},
},
"serial": &schema.Schema{
Type: schema.TypeSet,
Optional: true,
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": &schema.Schema{
@ -782,9 +782,9 @@ func diskSizeGB(dcSize interface{}) float64 {
diskString := strings.ToUpper(dcSize.(string))
re := regexp.MustCompile("([0-9]+)([A-Z]*)")
diskArray := re.FindStringSubmatch(diskString)
diskSize, _ = strconv.ParseFloat(diskArray[1], 64)
if len(diskArray) >= 3 {
switch diskArray[2] {
case "G", "GB":
@ -903,6 +903,12 @@ func initConnInfo(
ipMatch := rxIPconfig.FindStringSubmatch(d.Get("ipconfig0").(string))
sshHost = ipMatch[1]
}
// Check if we got a speficied port
if strings.Contains(sshHost, ":") {
sshParts := strings.Split(sshHost, ":")
sshHost = sshParts[0]
sshPort = sshParts[1]
}
} else {
log.Print("[DEBUG] setting up SSH forward")
sshPort, err = pxapi.SshForwardUsernet(vmr, client)