Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac OS Terraform issue with private keys #10

Open
vishal-biyani opened this issue Jan 17, 2020 · 1 comment
Open

Mac OS Terraform issue with private keys #10

vishal-biyani opened this issue Jan 17, 2020 · 1 comment

Comments

@vishal-biyani
Copy link

There is an issue with Terraform reading private keys on Mac OS - which causes the instance creation to fail.

module.yugabyte-db-cluster.google_compute_instance.yugabyte_node[2]: Provisioning with 'file'...
module.yugabyte-db-cluster.google_compute_instance.yugabyte_node[1]: Provisioning with 'file'...
module.yugabyte-db-cluster.google_compute_instance.yugabyte_node[0]: Provisioning with 'file'...

Error: Error applying plan:

3 errors occurred:
	* module.yugabyte-db-cluster.google_compute_instance.yugabyte_node[1]: Failed to parse key file "
<PRIVATE KEY CONTENT HERE>
": ssh: cannot decode encrypted private keys

There is a related issue open without any update: hashicorp/terraform#18927

Airflow has a similar issue but I am not clear/confident on the solution: PowerDataHub/terraform-aws-airflow#9

@KimRomBot
Copy link

KimRomBot commented Jan 20, 2020

I am having the same problem, though my SSH secret key is in a Bitbucket secure variable that is echoed into Terraform's dir on a step in the pipeline (encoded and decoded base64).

My configuration:

  provisioner "file" {
    source      = "../source/myVolume"
    destination = "/tmp"
    connection {
        type = "ssh"
        user = "terraform"
        private_key = file("${path.root}/ssh-key")
        host = google_compute_instance.default.network_interface.0.access_config.0.nat_ip 
    }
  }

EDIT:

Nevermind. My open SSH private key was made from a .ppk (putty) file that originally had a password on it. Made a new eky with no password and it worked. Had misremembered that it had one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants