Reputation: 3953
I have a terraform main.tf
and which has a remote-exec
provisioner to create a file, but it takes forever and gives the following error
Error: timeout - last error: SSH authentication failed ([email protected]:22): ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
And it never stops.
This is what I am trying to do:
resource "null_resource" "web3" {
triggers = {
key = "${uuid()}"
}
provisioner "remote-exec" {
inline = [
"touch /etc/machan_kohomada_remote_execution"
]
connection {
type = "ssh"
host = google_compute_instance.first-two-servers[0].network_interface.0.access_config.0.nat_ip
}
}
}
I think maybe I am using the remote-exec
function in a wrong way? What I need to do is:
I need to create a file /etc/remote_execution
in each google compute server
Upvotes: 0
Views: 270
Reputation: 1
this is complete connection block. try using a complete block
connection {
type = "ssh"
user = "ec2-user"
private_key = file("keypair2.pem")
host = aws_instance.my_instance.public_ip
}
Upvotes: 0