base64 encode一下private key:

1
cat ~/.ssh/your_private_key | base64

connection中decode一下:

1
2
3
4
5
6
7
connection {
type = "ssh"
user = "admin"
private_key = base64decode(var.private_key)
host = self.public_ip_address
timeout = "3600s"
}