support terraform 0.12 connection rules

This commit is contained in:
Grant Gongaware 2019-10-10 10:29:02 -07:00
parent 23e407d44c
commit e38fec05ce
2 changed files with 21 additions and 0 deletions

View File

@ -172,6 +172,14 @@ auto eth0
iface eth0 inet dhcp
EOF
connection {
type = "ssh"
user = "${self.ssh_user}"
private_key = "${self.ssh_private_key}"
host = "${self.ssh_host}"
port = "${self.ssh_port}"
}
provisioner "remote-exec" {
inline = [
"ip a"

View File

@ -391,6 +391,14 @@ func resourceVmQemu() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"ssh_host": {
Type: schema.TypeString,
Computed: true,
},
"ssh_port": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
@ -922,6 +930,11 @@ func initConnInfo(
// Done with proxmox API, end parallel and do the SSH things
pmParallelEnd(pconf)
// Optional convience attributes for provisioners
d.Set("ssh_host", sshHost)
d.Set("ssh_port", sshPort)
// This connection INFO is longer shared up to the providers :-(
d.SetConnInfo(map[string]string{
"type": "ssh",
"host": sshHost,