不能让文件配置器在DigitalOcean上使用Terraform(Cannot have file provisioner working with Terraform on DigitalOcean)
我尝试使用Terraform创建一个安装了consul的DigitalOcean节点。 我正在使用以下.tf文件,但它挂起并且不会将consul .zip文件复制到Droplet上。
几分钟后我收到以下错误消息:
- ssh:handshake失败:ssh:无法进行身份验证,尝试的方法[none publickey],没有支持的方法
然而,正确地创建了液滴。 我可以使用我指定的密钥登录命令行(因此不指定密码)。 我猜测连接部分可能有问题,但不确定我错过了什么。
任何想法 ?
variable "do_token" {} # Configure the DigitalOcean Provider provider "digitalocean" { token = "${var.do_token}" } # Create nodes resource "digitalocean_droplet" "consul" { count = "1" image = "ubuntu-14-04-x64" name = "consul-${count.index+1}" region = "lon1" size = "1gb" ssh_keys = ["7b:51:d3:e3:ae:6e:c6:e2:61:2d:40:56:17:54:fc:e3"] connection { type = "ssh" user = "root" agent = true } provisioner "file" { source = "consul_0.7.1_linux_amd64.zip" destination = "/tmp/consul_0.7.1_linux_amd64.zip" } provisioner "remote-exec" { inline = [ "sudo unzip -d /usr/local/bin /tmp/consul_0.7.1_linux_amd64.zip" ] } }
I try to use Terraform to create a DigitalOcean node on which consul is installed.
I'm using the following
.tf
file but it hangs up and do not copy the consul .zip file onto the droplet.I got the following error message after a couple of minutes:
ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
The droplets are correctly created though. I can login on command line with the key I specified (thus not specifying password). I'm guessing the connection part might be faulty but not sure what I'm missing.
Any idea ?
variable "do_token" {} # Configure the DigitalOcean Provider provider "digitalocean" { token = "${var.do_token}" } # Create nodes resource "digitalocean_droplet" "consul" { count = "1" image = "ubuntu-14-04-x64" name = "consul-${count.index+1}" region = "lon1" size = "1gb" ssh_keys = ["7b:51:d3:e3:ae:6e:c6:e2:61:2d:40:56:17:54:fc:e3"] connection { type = "ssh" user = "root" agent = true } provisioner "file" { source = "consul_0.7.1_linux_amd64.zip" destination = "/tmp/consul_0.7.1_linux_amd64.zip" } provisioner "remote-exec" { inline = [ "sudo unzip -d /usr/local/bin /tmp/consul_0.7.1_linux_amd64.zip" ] } }
原文:https://stackoverflow.com/questions/41102325