From e38fec05ce908ab5e10828189dc1122b342b50ee Mon Sep 17 00:00:00 2001 From: Grant Gongaware Date: Thu, 10 Oct 2019 10:29:02 -0700 Subject: [PATCH] support terraform 0.12 connection rules --- README.md | 8 ++++++++ proxmox/resource_vm_qemu.go | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/README.md b/README.md index 51b1693..d0d1f5e 100644 --- a/README.md +++ b/README.md @@ -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" diff --git a/proxmox/resource_vm_qemu.go b/proxmox/resource_vm_qemu.go index ed3110b..6b56daa 100644 --- a/proxmox/resource_vm_qemu.go +++ b/proxmox/resource_vm_qemu.go @@ -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,