I wrote a small plugin for generating SSH key pairs using new datasource API. It allows to simplify configurations - no need to use external build scripts for running ssh-keygen and using vars or environment to pass data to Packer.
Reach out if you need help doing so!
One note you may be interested in – to prevent the plugin name from stuttering (“sshkey-sshkey”) You can register the plugin in main.go using the constant
plugin.DEFAULT_NAME instead of the string
more info can be found here: Extending | Packer by HashiCorp
Thanks, I’ll consider making a PR.
BTW, looking at packer/plugin.go at master · hashicorp/packer · GitHub, it looks like plugin.DEFAULT_NAME is not handled for datasources. Should I raise an issue on GitHub?
Oh gosh yes please do open an issue! That’s not right.