hetznercloud / packer-plugin-hcloud

Packer plugin for Hetzner Cloud Builder
https://developer.hashicorp.com/packer/integrations/hetznercloud/hcloud
Mozilla Public License 2.0
22 stars 21 forks source link

Add `ssh_username` to the list of required options #37

Closed bonsi closed 2 years ago

bonsi commented 2 years ago

Required options according to the docs

// ...
source "hcloud" "ubuntu" {
  // token was set using HCLOUD_TOKEN
  image = "ubuntu-20.04"
  location = "fsn1"
  server_type = "cx11"
}
// ...

packer validate output:

Error: 1 error(s) occurred:

* An ssh_username must be specified
  Note: some builders used to default ssh_username to "root".
bonsi commented 2 years ago

I see and I now understand why it wouldn't be listed as a required option for the builder itself. For me as a total newcomer to Packer it just wasn't immediately clear because I have to go step by step and start with the examples given, which obviously don't include the SSH options because it's a separate "thing" in Packer-land. The Packer docs are great if you have a general understanding of all the moving parts, but as a newcomer those kind of "inner" workings and how it all fits together aren't that obvious.

sylviamoss commented 2 years ago

Thanks for the feedback! Would it be better if the communicator options are somehow highlighted? I agree that it's kinda hidden information about the communicator. Feel free to suggest any changes to that part as well.

bonsi commented 2 years ago

@sylviamoss - the information is there, if you know what you are looking for.

I've got 3 different suggestions, ranking from less to more work :grin: :

  1. Quick fix: just add ssh_username to the example at the bottom of the page (just like some of the examples for the amazon-ebs builder (see here). If newbies like me just copy the examples, they'll have everything they need to get started. Edit: after some more careful inspection of the builder page, I noticed ssh_username is already included in the JSON example at the bottom of the page. I totally missed that since JSON is no longer relevant for the current Packer version.
  2. Add an explicit Communicator Block to the hcloud.bulder just like on the amazon-ebs builder page for example
  3. A broader and more encompassing suggestion: add a new kind of block at the top of every builder page which lists all Communicators that can be used in conjunction with the builder. This block could link to the relevant Communicator page with all the options. This would make it very clear Communicators are an important part of every builder and at the same time it would clean up the extensive docs for builders like amazon-ebs by not repeating information (aka DRY). I personally really like how the JSON/HCL2 tabbed examples block looks for some of the builder docs like GCP compared to listing JSON and HCL2 example after another as can been seen here.

Your thoughts?