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.
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