diff --git a/.web-docs/components/builder/hcloud/README.md b/.web-docs/components/builder/hcloud/README.md index bc163d30..c962094e 100644 --- a/.web-docs/components/builder/hcloud/README.md +++ b/.web-docs/components/builder/hcloud/README.md @@ -67,6 +67,9 @@ builder. - `server_name` (string) - The name assigned to the server. The Hetzner Cloud sets the hostname of the machine to this value. +- `server_labels` (map of key/value strings) - Key/value pair labels to + apply to the created server. + - `snapshot_name` (string) - The name of the resulting snapshot that will appear in your account as image description. Defaults to `packer-{{timestamp}}` (see [configuration templates](/packer/docs/templates/legacy_json_templates/engine) for more info). @@ -87,6 +90,9 @@ builder. - `user_data_file` (string) - Path to a file that will be used for the user data when launching the server. +- `ssh_keys_labels` (map of key/value strings) - Key/value pair labels to + apply to the created ssh keys. + - `ssh_keys` (array of strings) - List of SSH keys by name or id to be added to image on launch. diff --git a/builder/hcloud/config.go b/builder/hcloud/config.go index a824376d..442cb318 100644 --- a/builder/hcloud/config.go +++ b/builder/hcloud/config.go @@ -45,7 +45,7 @@ type Config struct { UserData string `mapstructure:"user_data"` UserDataFile string `mapstructure:"user_data_file"` SSHKeys []string `mapstructure:"ssh_keys"` - SSHKeyLabels map[string]string `mapstructure:"sshkey_labels"` + SSHKeysLabels map[string]string `mapstructure:"ssh_keys_labels"` Networks []int64 `mapstructure:"networks"` RescueMode string `mapstructure:"rescue"` diff --git a/builder/hcloud/config.hcl2spec.go b/builder/hcloud/config.hcl2spec.go index 47c0ab8a..1f4536fa 100644 --- a/builder/hcloud/config.hcl2spec.go +++ b/builder/hcloud/config.hcl2spec.go @@ -82,7 +82,7 @@ type FlatConfig struct { UserData *string `mapstructure:"user_data" cty:"user_data" hcl:"user_data"` UserDataFile *string `mapstructure:"user_data_file" cty:"user_data_file" hcl:"user_data_file"` SSHKeys []string `mapstructure:"ssh_keys" cty:"ssh_keys" hcl:"ssh_keys"` - SSHKeyLabels map[string]string `mapstructure:"sshkey_labels" cty:"sshkey_labels" hcl:"sshkey_labels"` + SSHKeysLabels map[string]string `mapstructure:"ssh_keys_labels" cty:"ssh_keys_labels" hcl:"ssh_keys_labels"` Networks []int64 `mapstructure:"networks" cty:"networks" hcl:"networks"` RescueMode *string `mapstructure:"rescue" cty:"rescue" hcl:"rescue"` } @@ -171,7 +171,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec { "user_data": &hcldec.AttrSpec{Name: "user_data", Type: cty.String, Required: false}, "user_data_file": &hcldec.AttrSpec{Name: "user_data_file", Type: cty.String, Required: false}, "ssh_keys": &hcldec.AttrSpec{Name: "ssh_keys", Type: cty.List(cty.String), Required: false}, - "sshkey_labels": &hcldec.AttrSpec{Name: "sshkey_labels", Type: cty.Map(cty.String), Required: false}, + "ssh_keys_labels": &hcldec.AttrSpec{Name: "ssh_keys_labels", Type: cty.Map(cty.String), Required: false}, "networks": &hcldec.AttrSpec{Name: "networks", Type: cty.List(cty.Number), Required: false}, "rescue": &hcldec.AttrSpec{Name: "rescue", Type: cty.String, Required: false}, } diff --git a/builder/hcloud/step_create_sshkey.go b/builder/hcloud/step_create_sshkey.go index b39cdde4..f334a92a 100644 --- a/builder/hcloud/step_create_sshkey.go +++ b/builder/hcloud/step_create_sshkey.go @@ -37,7 +37,7 @@ func (s *stepCreateSSHKey) Run(ctx context.Context, state multistep.StateBag) mu key, _, err := client.SSHKey.Create(ctx, hcloud.SSHKeyCreateOpts{ Name: name, PublicKey: string(c.Comm.SSHPublicKey), - Labels: c.SSHKeyLabels, + Labels: c.SSHKeysLabels, }) if err != nil { err := fmt.Errorf("Error creating temporary SSH key: %s", err) diff --git a/docs/builders/hcloud.mdx b/docs/builders/hcloud.mdx index 45d99f35..7004d76c 100644 --- a/docs/builders/hcloud.mdx +++ b/docs/builders/hcloud.mdx @@ -80,6 +80,9 @@ builder. - `server_name` (string) - The name assigned to the server. The Hetzner Cloud sets the hostname of the machine to this value. +- `server_labels` (map of key/value strings) - Key/value pair labels to + apply to the created server. + - `snapshot_name` (string) - The name of the resulting snapshot that will appear in your account as image description. Defaults to `packer-{{timestamp}}` (see [configuration templates](/packer/docs/templates/legacy_json_templates/engine) for more info). @@ -100,6 +103,9 @@ builder. - `user_data_file` (string) - Path to a file that will be used for the user data when launching the server. +- `ssh_keys_labels` (map of key/value strings) - Key/value pair labels to + apply to the created ssh keys. + - `ssh_keys` (array of strings) - List of SSH keys by name or id to be added to image on launch.