Report this

What is the reason for this report?

how-to-use-terraform-with-digitalocean

Posted on May 13, 2020

As I was following thought the tutorial on the same topic, https://www.digitalocean.com/community/tutorials/how-to-use-terraform-with-digitalocean I successful was able to create a nginx server but then an error happened, beginning from the md5 of ssh public key <Failed to parse ssh private key: ssh: cannot decode encrypted private keys> The tutorial is recent and I’m running this on MacOS. Any help will be appreciated



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

yes I have the same TF file that is used within the tutorial. However, the ssh keys that is encrypted poorly is not being sync. An error is thrown because of this and that DO cannot decrypt the poor encryption. Error: Failed to parse ssh private key: ssh: cannot decode encrypted private keys it’s the same as the one I added to my account

Upon further researching, I cam across this troubleshooting https://stackoverflow.com/questions/54982050/parseprivatekeywithpassphrase-returns-ssh-cannot-decode-encrypted-private-keys

Below states that DO doesn’t support openSSh encrypted keys

If you look at the docs here : https://www.terraform.io/docs/provisioners/connection.html. I don’t see a field to set the pass for the key. So I would try again with an unencrypted key and it should work. Alternatively, you could simply use the user_data field instead of remote-exec. I’m no cloud init expert, but I believe it wouldn’t require a ssh connection then. Also like I said, I would really add the key to DO so that you don’t need so many variables and can just reference the key from your digitalocean_ssh_key resource.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.