Question

how-to-use-terraform-with-digitalocean

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


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.

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

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