GCE File provisioner failure with google_compute_instance

566 views
Skip to first unread message

Grant Trevor

unread,
Jul 20, 2015, 7:16:49 PM7/20/15
to terrafo...@googlegroups.com

I'm trying to use the file provisioner with a google_compute_instance resource and it's failing on the ssh handshake with the following error being received on each attempt:

2015/07/21 09:09:46 terraform-provisioner-file: 2015/07/21 09:09:46 connecting to TCP connection for SSH
2015/07/21 09:09:46 terraform-provisioner-file: 2015/07/21 09:09:46 handshaking with SSH
2015/07/21 09:09:47 terraform-provisioner-file: 2015/07/21 09:09:47 handshake error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
2015/07/21 09:09:47 terraform-provisioner-file: 2015/07/21 09:09:47 Retryable error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

I thought this may have been related to a bug fixed in the latest release of Terraform 0.6.1

- connection/ssh: fix issue on machines with an SSH Agent available preventing key_file from being read without explicitly setting agent = false [GH-2615]

However this does not appear to be the case so I'm assuming is wrong with my definition, the resource definition I'm using is provide below.


resource "google_compute_instance" "default" {
    name
= "instance-name"
    machine_type
= "n1-standard-2"
    zone
= "asia-east1-b"
    tags
= ["my-tag"]


    disk
{
        image
= "debian-7-wheezy-v20140814"
   
}


   
// Local SSD disk
    disk
{
        type
= "local-ssd"
        scratch
= true
   
}


    network_interface
{
        network
= "default"
        access_config
{
           
// Ephemeral IP
       
}
   
}


    service_account
{
        scopes
= ["userinfo-email", "compute-ro", "storage-ro"]
   
}


    provisioner
"file" {
      source
= "provision/boostrap.sh"
      destination
= "/tmp/boostrap.sh"
   
}


    provisioner
"remote-exec" {
       
inline = ["/tmp/boostrap.sh args"]
   
}
}

Dave Cunningham

unread,
Jul 21, 2015, 7:49:22 AM7/21/15
to terrafo...@googlegroups.com
Can you ssh in normally (i.e. with ssh, not with gcloud ssh or the developers console).  If not, have you added your ssh key to the project-wide metadata?
On Google, ssh keys on the machine are managed dynamically, either set up temporarily for a single ssh connection (gcloud ssh & the ssh button), or they are set up permanently by you adding them to the project-wide metadata.  Try this link:


This should allow you ssh access to all future and existing instances in the project.


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/5f54b4b4-8c02-4b39-84f9-8f9f7a393bc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages