我正在按照这个教程 https://www.digitalocean.com/community/tutorials/how-to-use-ansible-with-terraform-for-configuration-management 学习 Terraform 和 Ansible。
当我执行 terraform apply
命令时,它会抛出一个错误:
digitalocean_droplet.web[2]: Provisioning with 'remote-exec'...
Error: Failed to parse ssh private key: ssh: this private key is passphrase protected
Error: Error creating droplet: POST https://api.digitalocean.com/v2/droplets: 422 Failed to resolve VPC
on droplets.tf line 1, in resource "digitalocean_droplet" "web":
1: resource "digitalocean_droplet" "web" {
这是代码:
provisioner "remote-exec" {
inline = ["sudo apt update", "sudo apt install python3 -y", "echo DONE!"]
connection {
host = self.ipv4_address
type = "ssh"
user = "root"
private_key = file(var.pvt_key)
}
}
我机器上的私钥 SSH key (~/.ssh/id_rsa
) 受到了口令保护。我该如何使用它?