你有两种可能性:
将密钥添加到您的 ssh-agent :
ssh-agent
ssh-add ../.ssh/terraform
并使用 agent = true 在您的配置中。这个案子对你有用
agent = true
修改配置以直接使用密钥
secret_key = "../.ssh/terraform"
或者。有关更具体的语法,请参阅文档。
我有同样的问题,我做了以下配置
connection { type = "ssh" user = "ec2-user" private_key = "${file("*.pem")}" timeout = "2m" agent = false }