2018-10-17 06:15:47 -04:00
|
|
|
---
|
|
|
|
description: |
|
2018-10-17 07:37:48 -04:00
|
|
|
The Hetzner Cloud Packer builder is able to create new images for use with the
|
|
|
|
Hetzner Cloud. The builder takes a source image, runs any provisioning
|
2018-10-17 06:15:47 -04:00
|
|
|
necessary on the image after launching it, then snapshots it into a reusable
|
|
|
|
image. This reusable image can then be used as the foundation of new servers
|
|
|
|
that are launched within the Hetzner Cloud.
|
|
|
|
layout: docs
|
|
|
|
page_title: 'Hetzner Cloud - Builders'
|
|
|
|
sidebar_current: 'docs-builders-hetzner-cloud'
|
|
|
|
---
|
|
|
|
|
|
|
|
# Hetzner Cloud Builder
|
|
|
|
|
|
|
|
Type: `hcloud`
|
|
|
|
|
2018-10-26 20:02:51 -04:00
|
|
|
The `hcloud` Packer builder is able to create new images for use with [Hetzner
|
|
|
|
Cloud](https://www.hetzner.cloud). The builder takes a source image, runs any
|
|
|
|
provisioning necessary on the image after launching it, then snapshots it into
|
|
|
|
a reusable image. This reusable image can then be used as the foundation of new
|
|
|
|
servers that are launched within the Hetzner Cloud.
|
2018-10-17 06:15:47 -04:00
|
|
|
|
|
|
|
The builder does *not* manage images. Once it creates an image, it is up to you
|
|
|
|
to use it or delete it.
|
|
|
|
|
|
|
|
## Configuration Reference
|
|
|
|
|
|
|
|
There are many configuration options available for the builder. They are
|
|
|
|
segmented below into two categories: required and optional parameters. Within
|
|
|
|
each category, the available configuration keys are alphabetized.
|
|
|
|
|
|
|
|
In addition to the options listed here, a
|
|
|
|
[communicator](/docs/templates/communicator.html) can be configured for this
|
|
|
|
builder.
|
|
|
|
|
|
|
|
### Required:
|
|
|
|
|
2018-10-26 20:02:51 -04:00
|
|
|
- `token` (string) - The client TOKEN to use to access your account. It can
|
|
|
|
also be specified via environment variable `HCLOUD_TOKEN`, if set.
|
2018-10-17 06:15:47 -04:00
|
|
|
|
2018-10-26 04:09:20 -04:00
|
|
|
- `image` (string) - ID or name of image to launch server from.
|
2018-10-17 06:15:47 -04:00
|
|
|
|
2018-10-17 07:37:48 -04:00
|
|
|
- `location` (string) - The name of the location to launch the server in.
|
2018-10-17 06:15:47 -04:00
|
|
|
|
2018-10-26 20:02:51 -04:00
|
|
|
- `server_type` (string) - ID or name of the server type this server should
|
|
|
|
be created with.
|
2018-10-17 06:15:47 -04:00
|
|
|
|
|
|
|
### Optional:
|
|
|
|
|
|
|
|
- `endpoint` (string) - Non standard api endpoint URL. Set this if you are
|
2018-10-17 07:37:48 -04:00
|
|
|
using a Hetzner Cloud API compatible service. It can also be specified via
|
2018-10-17 06:15:47 -04:00
|
|
|
environment variable `HCLOUD_ENDPOINT`.
|
|
|
|
|
2018-10-17 07:37:48 -04:00
|
|
|
- `server_name` (string) - The name assigned to the server. The Hetzner Cloud
|
2018-10-17 06:15:47 -04:00
|
|
|
sets the hostname of the machine to this value.
|
|
|
|
|
|
|
|
- `snapshot_name` (string) - The name of the resulting snapshot that will
|
|
|
|
appear in your account. Defaults to "packer-{{timestamp}}" (see
|
|
|
|
[configuration templates](/docs/templates/engine.html) for more info).
|
|
|
|
|
2018-10-26 20:02:51 -04:00
|
|
|
- `poll_interval` (string) - Configures the interval in which actions are
|
|
|
|
polled by the client. Default `500ms`. Increase this interval if you run
|
|
|
|
into rate limiting errors.
|
2018-10-17 06:15:47 -04:00
|
|
|
|
2018-10-31 10:22:29 -04:00
|
|
|
- `user_data` (string) - User data to launch with the server. Packer will not
|
|
|
|
automatically wait for a user script to finish before shutting down the
|
|
|
|
instance this must be handled in a provisioner.
|
2018-10-17 06:15:47 -04:00
|
|
|
|
|
|
|
- `user_data_file` (string) - Path to a file that will be used for the user
|
2018-10-17 07:37:48 -04:00
|
|
|
data when launching the server.
|
2018-10-17 06:15:47 -04:00
|
|
|
|
2018-11-20 13:57:44 -05:00
|
|
|
- `ssh_keys` (array of strings) - List of SSH keys by name or id to be added
|
|
|
|
to image on launch.
|
|
|
|
|
2018-10-17 06:15:47 -04:00
|
|
|
## Basic Example
|
|
|
|
|
|
|
|
Here is a basic example. It is completely valid as soon as you enter your own
|
|
|
|
access tokens:
|
|
|
|
|
|
|
|
``` json
|
|
|
|
{
|
|
|
|
"type": "hcloud",
|
|
|
|
"token": "YOUR API KEY",
|
|
|
|
"image": "ubuntu-18.04",
|
|
|
|
"location": "nbg1",
|
|
|
|
"server_type": "cx11",
|
|
|
|
"ssh_username": "root"
|
|
|
|
}
|
|
|
|
```
|