I want to copy and execute file to linux VM using file and remote-exec provisioner and connect using bastion host but getting following error:
timeout - last error: Error connecting to bastion: ssh: handshake failed: EOF
Below is my provisioner codes:
connection {
#type = “ssh”
user = “ncsmanohar”
password = “P@ssw0rd1234”
#agent = “false”
host = azurerm_network_interface.myNIC.private_ip_address
bastion_host = “20.229.6.115”
bastion_port = “443”
#bastion_private_key = “eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInJlYWQiOjMwMDAwMDAwMDAwMCwidXBkYXRlIjoxODAwMDAwMDAwMDAwfX0=”
}
provisioner “file” {
source = “CIS_Red_Hat_Enterprise_Linux_7_Benchmark_v2.2.0.sh”
destination = “/home/ncsmanohar/CIS_Red_Hat_Enterprise_Linux_7_Benchmark_v2.2.0.sh”
}
provisioner "remote-exec" {
inline = [
"sudo chmod +x CIS_Red_Hat_Enterprise_Linux_7_Benchmark_v2.2.0.sh",
"sudo ./CIS_Red_Hat_Enterprise_Linux_7_Benchmark_v2.2.0.sh"
]
}