Open jseparovic opened 1 year ago
After adding DEBUG logs to terraform cloud I can see that the key file is not found.
[ERROR] Failed to read ssh key: open terraform_id_rsa: no such file or directory
So it looks like the plan fails because it is validating a file that does not yet exist. Is there some way to prevent this check? As the file will be created in the run.
Looks like the only way to make this work is to put the private key in the git repo linked to the Terraform Cloud workspace. Not ideal, I would much rather using a sensitive variable directly in Terraform Cloud.
This does work now after adding the key to .ssh/id_rsa
in my git repo
provider "libvirt" {
uri = "qemu+ssh://root@${var.target_host}/system?sshauth=privkey&keyfile=${path.module}/.ssh/id_rsa&no_verify=1"
}
There has to be a better way... I'd probably choose a long root password over this.
Hi @jseparovic could you check if this also happens when running Terraform locally? Also, could you check using latest provider version?
I am running into this as I was migrating my state to TF cloud. When I run local, works without issue.
Hi @bashfulrobot what paths are you using for the keys? Also, is the key password protected?
Just the default ~/.ssh/id_* files.
They do have a password that is cached in my keychain. I had been using this setup for months.
Password protection might be an issue here. I do not know if there's any possibility to provide password in Terraform Cloud - I highly doubt it.
System Information
Terraform Cloud
Description of Issue/Question
When trying to configure SSH Key authentication using Terraform Cloud, plan fails with the following error:
When using ssh password authentication the plan works no problem.
Are there any examples of how to use SSH keys with Terraform Cloud?
Setup
https://github.com/jseparovic/terraform-cloud-test/blob/main/main.tf
Steps to Reproduce Issue